LONG_MAX in D
nobody
nobody at mailinator.com
Thu Aug 17 18:10:03 PDT 2006
Luís Marques wrote:
> nobody wrote:
>> Another way to define LONG_MAX conditionally is explained in the
>> Static If Condition of the above page:
>>
>> static if(size_t.sizeof == 4)
>> const int LONG_MAX = int.max;
>>
>> static if(size_t.sizeof == 8)
>> const long LONG_MAX = long.max;
>
> Well, I don't see much point in that, over "size_t.max / 2" :-)
> (ah yes, now I notice that I forgot the ".max")
>
> Luís
I can certainly see why you might prefer size_t.max / 2. I would personally use
version statements with brackets if I were defining much more (LONG_MIN for
example since size_t.min is 0). Anyway you can't say "nobody" warned you! I just
pointed out the options. :-)
More information about the Digitalmars-d
mailing list