[xproto: PATCH] Xmd.h: amd64-x32 ABI defines sizeof(long) == sizeof (void*) == 4

Alan Coopersmith alan.coopersmith at oracle.com
Wed Dec 21 11:33:21 PST 2011


On 12/21/11 09:24, Sergei Trofimovich wrote:
> What do you think of changing predefined __amd64__ define in gcc to something
> distinct?
>
> If it's not an option, how about adding one more define for those who like to check
> for this exact feature on all compilers (and not only gcc)?
>
> So thread start's use case would look like
>
>      -#if defined(__amd64__)
>      -#    define LONG64
>      -#endif
>      +#if defined(__amd64__)&&  !defined(__amd64_x32__)
>      +#    define LONG64
>      +#endif
>
> which would be less fragile for existing compilers.

The correct thing to do would be to never define __amd64__ if you are not 
building software using the characteristics tons of existing software associate
with __amd64__ - almost all C code using this cares about the pointer sizes
you're redefining - it doesn't care about the number of registers or other
attributes not visible at the C source code level.

That would result in no patch to X or thousands of other programs.

-- 
	-Alan Coopersmith-        alan.coopersmith at oracle.com
	 Oracle Solaris Platform Engineering: X Window System



More information about the xorg-devel mailing list