Sam writes...
>On Mon, 5 Jul 1999, Aaron Nabil wrote:
>
>> Sam writes...
>> >On Mon, 5 Jul 1999, Aaron Nabil wrote:
>> >
>> >> . . .
>> >> UL: x=987654321
>> >> ULL: x=87654321
>> >
>> >Your native compiler has a bug.
>>
>> A warning or error would be desirable if ULL isn't part of the
>> implementation's grammar (instead of silently emitting broken code).
>>
>> Or were you suggesting the reason it's broken was that it doesn't
>> grok "ULL" but should?
>
>No, the reason its broken is because when casting an ULL to UL, the
>compiler appears to simply lop off the topmost digits until the number
>fits into an UL, instead of taking the remainder of the ULL divided by
>2^(sizeof(UL)*8).
That's not the problem. On an alpha, a "long long" and a "long" are
both 8 bytes, no casting required. Besides, even on a sizeof(long) = 8
machine, 987654321 would still fit inside a long.
>This should happen automatically even if compiler does not support ULL,
>however, in that case, it should really refuse to compile it in the first
>place.
Yup.
Or the author could have taken avoided using non-standard C in the first
place.
--
Aaron Nabil