std C/C++ patch #11

Eddie Kohler kohler at icir.org
Tue Apr 30 13:13:38 EDT 2002


> I believe the config test is done with the C++ compiler and the C
> compiler is the one objecting.  Someone at Sun decided (from
> inttypes.h):
> 
>   #ifdef	_LP64
>   typedef long			int64_t;
>   #else	/* _ILP32 */
>   #if __STDC__ - 0 == 0 && !defined(_NO_LONGLONG)
>   typedef	long long		int64_t;
>   #endif
> 
> Since for standard C, __STDC__ is non-zero, and, by definition,
> __STDC__ should not be non-zero when __cplusplus is, the explicit
> 64-bit types are allowed in C++, but not C, for ILP32 environment
> (perhaps some POSIX thing?).

Actually the C++ standard leaves it implementation-defined whether __STDC__
is defined and what its value is. Gnu C++ defines __STDC__ and __cplusplus.
I'd expect that behavior from most compilers. Apparently I'm wrong.

Click pretty deeply assumes that, for things like int64_t, the C and C++
compilers have the same capabilities. How can we convince Sun C to do the
right thing? Should it be a configure test, or just a note ("set CFLAGS to
-D_LP64", or something)?

Eddie



More information about the click mailing list