lightning
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Lightning] WORDSIZE detection with GCC 4.2


From: Vitaly Magerya
Subject: Re: [Lightning] WORDSIZE detection with GCC 4.2
Date: Mon, 02 Sep 2013 20:12:45 +0300
User-agent: Thunderbird

On 09/02/2013 18:47, Paulo César Pereira de Andrade wrote:
>   I just started working on having 2 vms (i386 and amd64) of FreeBSD 9.1
> so that I can keep a test environment.

Cool, thanks.

>> Is there a better solution?
> 
>   There may be something else in "cpp -dM /dev/null", or some header
> like <limits.h>.

Yea, I looked at those, and didn't find anything appropriate; you can
have at look yourself at [1] (note that WORD_BIT is size of 'int', so
it's 32 on both i386 and amd64).

Comparing SIZE_T_MAX from limits.h with 0xffffffffU maybe? There's also
UINTPTR_MAX in stdint.h, which looks more appropriate (if relying on
presence of stdint.h is something you're willing to accept).

What you ultimately want is a way to tell between ILP32, LP64 and fail
on everything else. Just testing for SIZE_T_MAX doesn't really guarantee
that you've got one of those two. Testing for a combination of
SIZE_T_MAX, INT_MAX, LONG_MAX, LLONG_MAX and UCHAR_MAX maybe?

>   It should work with CFLAGS="$CFLAGS -D__WORDSIZE=32" as
> it would not be overwritten anywhere...

Right, but then you'd need to document this so that every application
that uses lightning compiled with the same -D, and that is highly
inconvenient for the applications.

[1] http://pastebin.com/EfJbDZD8



reply via email to

[Prev in Thread] Current Thread [Next in Thread]