Re: uint64_t fails with C++ (again)

2014-02-14 Thread Werner LEMBERG
>>> I tend to work around these sorts of glitches using Gnulib; its >>> stdint module fixes the portability problem with >>> __STDC_LIMIT_MACROS that I know about. Admittedly Gnulib is not >>> for everybody. >> >> Hehe. I use gnulib, so this is just fine for me. > > Will test `stdint' module so

Re: uint64_t fails with C++ (again)

2014-02-07 Thread Werner LEMBERG
>> I tend to work around these sorts of glitches using Gnulib; its >> stdint module fixes the portability problem with >> __STDC_LIMIT_MACROS that I know about. Admittedly Gnulib is not >> for everybody. > > Hehe. I use gnulib, so this is just fine for me. Will test `stdint' module soon – I've

Re: uint64_t fails with C++ (again)

2014-02-07 Thread Werner LEMBERG
>> Will this problem be handled in a forthcoming autoconf release? > > I'm afraid I don't understand the problem yet, as your original > email defined __STDC_LIMIT_MACROS, but now you're saying that > -D__STDC_LIMIT_MACROS fixes the problem. Indeed, doing ./configure CC=g++ CPPFLAGS="-D__STDC

Re: uint64_t fails with C++ (again)

2014-02-07 Thread Paul Eggert
Werner LEMBERG wrote: Will this problem be handled in a forthcoming autoconf release? I'm afraid I don't understand the problem yet, as your original email defined __STDC_LIMIT_MACROS, but now you're saying that -D__STDC_LIMIT_MACROS fixes the problem. That being said, my guess is that it's

Re: uint64_t fails with C++ (again)

2014-02-07 Thread Werner LEMBERG
>> Repeating your test verbatim I get the #error message! > > How about if you compile with the following command instead? > > g++ -D__STDC_LIMIT_MACROS -c t.cc > > That fixes the problem on RHEL 6.4, anyway. It works for me, too. Will this problem be handled in a forthcoming autoconf release

Re: uint64_t fails with C++ (again)

2014-02-07 Thread Paul Eggert
Werner LEMBERG wrote: Repeating your test verbatim I get the #error message! I'm not too surprised, since you're probably using a pre-C++11 system. I get the same #error on RHEL 6.4, which uses g++ (GCC) 4.4.7 20120313 (Red Hat 4.4.7-3), which is older even than your compiler. How about if

Re: uint64_t fails with C++ (again)

2014-02-06 Thread Werner LEMBERG
Hello Paul! >> neither `UINT64_MAX' nor `uint64_t' gets define > > That's odd, because UINT64_MAX is defined for me, even for this > much-simpler program: > > #include > #ifdef UINT64_MAX > typedef uint64_t TA_ULongLong; > #else > # error "No unsigned 64bit wide data type found." > #endif > >

Re: uint64_t fails with C++ (again)

2014-02-06 Thread Paul Eggert
Werner LEMBERG wrote: neither `UINT64_MAX' nor `uint64_t' gets define That's odd, because UINT64_MAX is defined for me, even for this much-simpler program: #include #ifdef UINT64_MAX typedef uint64_t TA_ULongLong; #else # error "No unsigned 64bit wide data type found." #endif If I put this

uint64_t fails with C++ (again)

2014-02-06 Thread Werner LEMBERG
In 2011, there was the following thread started by me: http://lists.gnu.org/archive/html/autoconf/2011-12/msg2.html The solution that worked eventually was to put AC_PROG_CC AC_PROG_CPP AC_TYPE_UINT64_T into my configure.ac file, and #include /* make `stdint.h' define `uint

Re: uint64_t fails with C++

2011-12-07 Thread Paul Eggert
Thanks for the details. I pushed this patch into autoconf: AC_LANG_BOOL_COMPILE_TRY(C): port to g++ with warnings * lib/autoconf/c.m4 (AC_LANG_BOOL_COMPILE_TRY(C)): Use the array as well as setting it, to pacify g++. Reported by Werner Lemberg in

Re: uint64_t fails with C++

2011-12-07 Thread Paul Eggert
On 12/07/11 14:20, Nick Bowler wrote: > a program does *not* need to define __STDC_LIMIT_MACROS prior > to including Ah, then gnulib needs to be updated to match C++11. I'll propose a patch for that, in a different thread. ___ Autoconf mailing list Aut

Re: uint64_t fails with C++

2011-12-07 Thread Bob Friesenhahn
On Wed, 7 Dec 2011, Nick Bowler wrote: Clearly, depending on an implementation-dependent macro is not suitable for portable software. i thought __STDC_LIMIT_MACROS was part of the spec and thus not "implementation dependent" ? Sort-of. It is included non-normatively in the C specification a

Re: uint64_t fails with C++

2011-12-07 Thread Nick Bowler
On 2011-12-07 16:58 -0500, Mike Frysinger wrote: > On Wednesday 07 December 2011 16:18:26 Nick Bowler wrote: > > On 2011-12-07 15:31 -0500, Mike Frysinger wrote: > > > i thought __STDC_LIMIT_MACROS was part of the spec and thus not > > > "implementation dependent" ? > > > > Sort-of. It is include

Re: uint64_t fails with C++

2011-12-07 Thread Ben Pfaff
Mike Frysinger writes: > On Wednesday 07 December 2011 14:10:27 Bob Friesenhahn wrote: >> On Wed, 7 Dec 2011, Werner LEMBERG wrote: >> >> C++ compilers do not get these definition from stdint.h unless >> >> __STDC_LIMIT_MACROS is defined, the macros are in C99 and later, but >> >> were not in the

Re: uint64_t fails with C++

2011-12-07 Thread Nick Bowler
On 2011-12-07 15:31 -0500, Mike Frysinger wrote: > On Wednesday 07 December 2011 14:10:27 Bob Friesenhahn wrote: > > On Wed, 7 Dec 2011, Werner LEMBERG wrote: > > >> C++ compilers do not get these definition from stdint.h unless > > >> __STDC_LIMIT_MACROS is defined, the macros are in C99 and later

Re: uint64_t fails with C++

2011-12-07 Thread Mike Frysinger
On Wednesday 07 December 2011 16:18:26 Nick Bowler wrote: > On 2011-12-07 15:31 -0500, Mike Frysinger wrote: > > On Wednesday 07 December 2011 14:10:27 Bob Friesenhahn wrote: > > > On Wed, 7 Dec 2011, Werner LEMBERG wrote: > > > >> C++ compilers do not get these definition from stdint.h unless > >

Re: uint64_t fails with C++

2011-12-07 Thread Werner LEMBERG
>> Thanks. However, this still doesn't explain why autoconf (using g++!) >> says that uint64_t exists: __STDC_LIMIT_MACROS is not used in any part >> of autoconf. > > I think that has been covered... Nope. A search for __STDC_LIMIT_MACROS within the git repository gives no results. >> PS: If u

Re: uint64_t fails with C++

2011-12-07 Thread Eric Blake
On 12/07/2011 11:08 AM, Werner LEMBERG wrote: > >>>#if defined UINT64_MAX || defined uint64_t >>>typedef uint64_t TA_ULongLong; >>>#else >>># error "No unsigned 64bit wide data type found." >>>#endif >> >> stdint.h will not define UINT64_MAX if __cplusplus is defined unless >>

Re: uint64_t fails with C++

2011-12-07 Thread Werner LEMBERG
> If you do need the UINT64_MAX etc macros as well as the uint64_t > type then you will have to define __STDC_LIMIT_MACROS. Yep. I believe this is something I would have never found out without assistance. Thanks again to all of you! Werner ___

Re: uint64_t fails with C++

2011-12-07 Thread Peter O'Gorman
On 12/07/2011 01:04 PM, Werner LEMBERG wrote: It's nothing to do with autoconf really, configure correctly finds uint64_t, your C program then checks for UINT64_MAX or a uint64_t macro instead of #include and checking for HAVE_UINT64_T. HAVE_UINT64_T is *not* defined in my... Sorry, my bad

Re: uint64_t fails with C++

2011-12-07 Thread Werner LEMBERG
> If the above guesswork holds, It doesn't :-) > then I wonder why your project uses C++ file extensions and $CC > (your said it was a C file). It should be either C file extensions > and $CC, or C++ file extensions and $CXX. Or? As Nelson Beebe has explained to me some time ago, there are a bu

Re: uint64_t fails with C++

2011-12-07 Thread Peter Rosin
Werner LEMBERG skrev 2011-12-07 21:08: >>> I still don't understand the details of the autoconf problem (and I >>> still think that something is fishy), but defining this macro works >>> just fine :-) >> >> Clearly, depending on an implementation-dependent macro is not >> suitable for portable soft

Re: uint64_t fails with C++

2011-12-07 Thread Mike Frysinger
On Wednesday 07 December 2011 14:10:27 Bob Friesenhahn wrote: > On Wed, 7 Dec 2011, Werner LEMBERG wrote: > >> C++ compilers do not get these definition from stdint.h unless > >> __STDC_LIMIT_MACROS is defined, the macros are in C99 and later, but > >> were not in the C++ standard of the day (I don

Re: uint64_t fails with C++

2011-12-07 Thread Werner LEMBERG
>> I still don't understand the details of the autoconf problem (and I >> still think that something is fishy), but defining this macro works >> just fine :-) > > Clearly, depending on an implementation-dependent macro is not > suitable for portable software. So please tell me how to solve this p

Re: uint64_t fails with C++

2011-12-07 Thread Bob Friesenhahn
On Wed, 7 Dec 2011, Werner LEMBERG wrote: C++ compilers do not get these definition from stdint.h unless __STDC_LIMIT_MACROS is defined, the macros are in C99 and later, but were not in the C++ standard of the day (I don't know if they're in later C++ standards), so aren't defined for C++ compi

Re: uint64_t fails with C++

2011-12-07 Thread Werner LEMBERG
> It's nothing to do with autoconf really, configure correctly finds > uint64_t, your C program then checks for UINT64_MAX or a uint64_t > macro instead of #include and checking for HAVE_UINT64_T. HAVE_UINT64_T is *not* defined in my ... > C++ compilers do not get these definition from stdint.h

Re: uint64_t fails with C++

2011-12-07 Thread Peter O'Gorman
On 12/07/2011 12:08 PM, Werner LEMBERG wrote: #if defined UINT64_MAX || defined uint64_t typedef uint64_t TA_ULongLong; #else # error "No unsigned 64bit wide data type found." #endif stdint.h will not define UINT64_MAX if __cplusplus is defined unless __STDC_LIMIT_MACROS

Re: uint64_t fails with C++

2011-12-07 Thread Werner LEMBERG
>>#if defined UINT64_MAX || defined uint64_t >>typedef uint64_t TA_ULongLong; >>#else >># error "No unsigned 64bit wide data type found." >>#endif > > stdint.h will not define UINT64_MAX if __cplusplus is defined unless > __STDC_LIMIT_MACROS is defined before you include it.

Re: uint64_t fails with C++

2011-12-07 Thread Peter O'Gorman
On 12/07/2011 03:17 AM, Werner LEMBERG wrote: #if defined UINT64_MAX || defined uint64_t typedef uint64_t TA_ULongLong; #else # error "No unsigned 64bit wide data type found." #endif stdint.h will not define UINT64_MAX if __cplusplus is defined unless __STDC_LIMIT_MACROS is de

Re: uint64_t fails with C++

2011-12-07 Thread Werner LEMBERG
>> My main question is: Why does the autoconf test succeeds (which >> properly uses g++ for its test according to the config.log file) >> but the compilation in my test file fails? A bug? A feature? > > Sorry, I'm not sure about that bit. Does config.log show it using > any special compiler opt

uint64_t fails with C++

2011-12-07 Thread Werner LEMBERG
In my configure.ac file I have AC_PROG_CC AC_PROG_CPP AC_TYPE_UINT64_T In my C file I have #include #if HAVE_STDINT_H # include #endif #if defined UINT64_MAX || defined uint64_t typedef uint64_t TA_ULongLong; #else # error "No unsigned 64bit wide data type found."

uint64_t fails with C++

2011-12-07 Thread Werner LEMBERG
[In case you receive this mulitple times, sorry for that.] In my configure.ac file I have AC_PROG_CC AC_PROG_CPP AC_TYPE_UINT64_T In my C file I have #include #if HAVE_STDINT_H # include #endif #if defined UINT64_MAX || defined uint64_t typedef uint64_t TA_ULongLong;

uint64_t fails with C++

2011-12-07 Thread Werner LEMBERG
In my configure.ac file I have AC_PROG_CC AC_PROG_CPP AC_TYPE_UINT64_T In my C file I have #include #if HAVE_STDINT_H # include #endif #if defined UINT64_MAX || defined uint64_t typedef uint64_t TA_ULongLong; #else # error "No unsigned 64bit wide data type found."