bug-gnulib
[Top][All Lists]
Advanced

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

LONG_LONG_MIN


From: Bruno Haible
Subject: LONG_LONG_MIN
Date: Sun, 7 Mar 2010 20:29:08 +0100
User-agent: KMail/1.9.9

Hi,

Compiling a gnulib testdir on Solaris/x86 with Sun C, I get these errors:

cc -O -xc99=all -DHAVE_CONFIG_H -DEXEEXT=\"\" -DEXEEXT=\"\" -DNO_XMALLOC  
-DEXEEXT=\"\" -I. -I..  -I../intl  -I/home/haible/prefix-x86/include 
-D_REENTRANT  -g -c -o xstrtoll.o xstrtoll.c
"xstrtol.c", line 49: undefined symbol: LONG_LONG_MIN
"xstrtol.c", line 54: undefined symbol: LONG_LONG_MAX
cc: acomp failed for xstrtoll.c
*** Error code 2

cc -O -xc99=all -DHAVE_CONFIG_H -DEXEEXT=\"\" -DEXEEXT=\"\" -DNO_XMALLOC  
-DEXEEXT=\"\" -I. -I..  -I../intl  -I/home/haible/prefix-x86/include 
-D_REENTRANT  -g -c -o xstrtoull.o xstrtoull.c
"xstrtol.c", line 54: undefined symbol: ULONG_LONG_MAX
cc: acomp failed for xstrtoull.c
*** Error code 2

The reason is that the files strtol.c, xstrtoll.c, lib/xstrtoull.c use the
macros LONG_LONG_MIN, LONG_LONG_MAX, ULONG_LONG_MAX. But these macros are
not standard. ISO C99 and POSIX specify that <limits.h> defines
LLONG_MIN, LLONG_MAX, ULLONG_MAX. The macros LONG_LONG_MIN, LONG_LONG_MAX,
ULONG_LONG_MAX come from gcc's <limits.h>:


  #if defined (__GNU_LIBRARY__) ? defined (__USE_GNU) : !defined 
(__STRICT_ANSI__)
  /* Minimum and maximum values a `signed long long int' can hold.  */
  # undef LONG_LONG_MIN
  # define LONG_LONG_MIN (-LONG_LONG_MAX - 1LL)
  # undef LONG_LONG_MAX
  # define LONG_LONG_MAX __LONG_LONG_MAX__

  /* Maximum value an `unsigned long long int' can hold.  (Minimum is 0).  */
  # undef ULONG_LONG_MAX
  # define ULONG_LONG_MAX (LONG_LONG_MAX * 2ULL + 1ULL)
  #endif


As you can see, these are not even defined with "gcc -ansi".

Suggestions? Should we use LLONG_MIN or better rely on the macros from
<stdint.h>?

Bruno




reply via email to

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