| Thread overview | |||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
January 25, 2009 Could we get a LP64 version identifier? | ||||
|---|---|---|---|---|
| ||||
Could we get a LP64 version identifier? I know that you can use this code: "static if ((void*).sizeof > int.sizeof)" to do the same but that's not particular clear that the programmer wants to check for LP64. If so, I hope we could get it in D1 also. | ||||
January 25, 2009 Re: Could we get a LP64 version identifier? | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Jacob Carlborg | Jacob Carlborg wrote: > Could we get a LP64 version identifier? I know that you can use this code: > > "static if ((void*).sizeof > int.sizeof)" Shouldn't that be "static if ((void*).sizeof == long.sizeof)" or just "static if ((void*).sizeof == 8)"? (Note that in D long.sizeof is guaranteed to be 8) > to do the same but that's not particular clear that the programmer wants to check for LP64. If so, I hope we could get it in D1 also. | |||
January 25, 2009 Re: Could we get a LP64 version identifier? | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Jacob Carlborg | On Sun, 25 Jan 2009 15:32:33 +0300, Jacob Carlborg <doobnet@gmail.com> wrote:
> Could we get a LP64 version identifier? I know that you can use this code:
>
> "static if ((void*).sizeof > int.sizeof)"
>
> to do the same but that's not particular clear that the programmer wants to check for LP64. If so, I hope we could get it in D1 also.
version (X86) {
...
} else {
...
}
| |||
January 25, 2009 Re: Could we get a LP64 version identifier? | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Frits van Bommel | Frits van Bommel wrote:
> Jacob Carlborg wrote:
>> Could we get a LP64 version identifier? I know that you can use this code:
>>
>> "static if ((void*).sizeof > int.sizeof)"
>
> Shouldn't that be "static if ((void*).sizeof == long.sizeof)" or just "static if ((void*).sizeof == 8)"?
> (Note that in D long.sizeof is guaranteed to be 8)
Yeah that would also work. In D both long and int have a fixed size, therefore should all three ways work.
| |||
January 25, 2009 Re: Could we get a LP64 version identifier? | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Denis Koroskin | Denis Koroskin wrote:
> On Sun, 25 Jan 2009 15:32:33 +0300, Jacob Carlborg <doobnet@gmail.com> wrote:
>
>> Could we get a LP64 version identifier? I know that you can use this code:
>>
>> "static if ((void*).sizeof > int.sizeof)"
>>
>> to do the same but that's not particular clear that the programmer wants to check for LP64. If so, I hope we could get it in D1 also.
>
> version (X86) {
> ...
> } else {
> ...
> }
>
Win64 and all non X86 32bit versions would fall in the else statement. Actually I now saw that D already has a D_LP64 version identifier.
| |||
January 25, 2009 Re: Could we get a LP64 version identifier? | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Jacob Carlborg | Jacob Carlborg wrote:
> Frits van Bommel wrote:
>> Jacob Carlborg wrote:
>>> Could we get a LP64 version identifier? I know that you can use this code:
>>>
>>> "static if ((void*).sizeof > int.sizeof)"
>>
>> Shouldn't that be "static if ((void*).sizeof == long.sizeof)" or just "static if ((void*).sizeof == 8)"?
>> (Note that in D long.sizeof is guaranteed to be 8)
>
> Yeah that would also work. In D both long and int have a fixed size, therefore should all three ways work.
Actually I now saw that D already has a D_LP64 version identifier.
| |||
January 25, 2009 Re: Could we get a LP64 version identifier? | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Jacob Carlborg | On Sun, 25 Jan 2009 17:30:38 +0300, Jacob Carlborg <doobnet@gmail.com> wrote:
> Denis Koroskin wrote:
>> On Sun, 25 Jan 2009 15:32:33 +0300, Jacob Carlborg <doobnet@gmail.com> wrote:
>>
>>> Could we get a LP64 version identifier? I know that you can use this code:
>>>
>>> "static if ((void*).sizeof > int.sizeof)"
>>>
>>> to do the same but that's not particular clear that the programmer wants to check for LP64. If so, I hope we could get it in D1 also.
>> version (X86) {
>> ...
>> } else {
>> ...
>> }
>>
>
> Win64 and all non X86 32bit versions would fall in the else statement. Actually I now saw that D already has a D_LP64 version identifier.
Hm.. you are right.
| |||
January 25, 2009 Re: Could we get a LP64 version identifier? | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Jacob Carlborg | On Sun, 25 Jan 2009 15:32:33 +0300, Jacob Carlborg <doobnet@gmail.com> wrote: > Could we get a LP64 version identifier? I know that you can use this code: > > "static if ((void*).sizeof > int.sizeof)" > > to do the same but that's not particular clear that the programmer wants to check for LP64. If so, I hope we could get it in D1 also. http://www.digitalmars.com/d/2.0/version.html D_LP64 - Pointers are 64 bits | |||
January 25, 2009 Re: Could we get a LP64 version identifier? | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Denis Koroskin | Denis Koroskin wrote: > On Sun, 25 Jan 2009 15:32:33 +0300, Jacob Carlborg <doobnet@gmail.com> wrote: > >> Could we get a LP64 version identifier? I know that you can use this code: >> >> "static if ((void*).sizeof > int.sizeof)" >> >> to do the same but that's not particular clear that the programmer wants to check for LP64. If so, I hope we could get it in D1 also. > > http://www.digitalmars.com/d/2.0/version.html > > D_LP64 - Pointers are 64 bits > It's also in D1: http://www.digitalmars.com/d/1.0/version.html | |||
January 25, 2009 Re: Could we get a LP64 version identifier? | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Jacob Carlborg | Jacob Carlborg wrote:
> Could we get a LP64 version identifier? I know that you can use this code:
>
> "static if ((void*).sizeof > int.sizeof)"
>
> to do the same but that's not particular clear that the programmer wants to check for LP64. If so, I hope we could get it in D1 also.
Yeah, I agree, and it's already in both for the next update. It'll be D_LP64.
| |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply