Could we get a LP64 version identifier?

Daniel Keep daniel.keep.lists at gmail.com
Tue Jan 27 04:50:57 PST 2009



Jacob Carlborg wrote:
> Frits van Bommel wrote:
>> Jacob Carlborg wrote:
>>> Walter Bright 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)"
>>>>>
>>>>> 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.
>>>>
>>>> [snip]
>>
>> Some testing shows that all DMD-frontend based compilers (i.e. DMD,
>> GDC and LDC) seem to produce that error message for any version
>> identifier starting with "D_" (Including "D_" itself).
> 
> Ok thanks. I guess I still have to use "static if"

Or, do this:

module platform; // Or call it whatever

enum
{
HAS_LP64 = ((void*).sizeof > int.sizeof)
}


Then, in your source:

import platform : HAS_LP64;

static if( HAS_LP64 )
{
    ...
}


I've done this a few times when I had several traits that I wanted to
compile against, and didn't want to have the tests all over the place.

  -- Daniel



More information about the Digitalmars-d mailing list