[Tux3] Question about 212c59f7565f

Michael Pattrick mpattrick at rhinovirus.org
Tue Aug 4 09:57:54 PDT 2009


Oh yes, you're right, I guess sizeof is calculated after the
preprocessor is done...

The following should be portable:
#if LONG_MAX == LLONG_MAX

Although, it is a tad less apparent what it is doing.

GCC also offers __WORDSIZE == 64 but I dont think anyone else does.

Cheers,
Michael

On 8/4/09, OGAWA Hirofumi <hirofumi at mail.parknet.co.jp> wrote:
> Michael Pattrick <mpattrick at rhinovirus.org> writes:
>
>> Sorry if that previous message was a little ambiguous, what I meant
>> was: wouldn’t the following snippet achieve the same result without
>> having to work around a GCC warning?
>>
>> #if BITS_PER_LONG == 64
>> 	if ((word & 0xffffffff) == 0) {
>> 		num += 32;
>> 		word >>= 32;
>> 	}
>> #endif
>
> You have same miss with me. :) sizeof() can't use for #if.  I guess
> better fix would make BITS_PER_LONG constants, but I didn't find the way
> to do.
>
> Thanks.
> --
> OGAWA Hirofumi <hirofumi at mail.parknet.co.jp>
>

_______________________________________________
Tux3 mailing list
Tux3 at tux3.org
http://mailman.tux3.org/cgi-bin/mailman/listinfo/tux3



More information about the Tux3 mailing list