Boost logo

Boost :

From: John Max Skaller (skaller_at_[hidden])
Date: 2001-06-22 18:26:33


Jens Maurer wrote:
>
> John Max Skaller wrote:
> >
> > 0. My system is linux/gcc 2.95.3.pentium:
> >
> > g++ -Wno-long-long -pedantic -ansi -shared -Iboost_1_22_0 ...
>
> What is your versioh of glibc?
> (find out with "ldd --version")

ldd (GNU libc) 2.1.2
 
> > 6. /usr/include/stdint.h exists, and it defines (u)int64_t
>
> Note that the definition of (u)int64_t is not (primarily) a
> feature of your compiler, but of your standard library. On
> Linux, these are separate things.

        Right.

> There is also a definition of (u)intXX_t in /usr/include/sys/types.h,
> at least here on glibc 2.2.3. Unfortunately, for (u)int64_t, these
> definitions are slightly different. In particular,
> stdint.h says (note the absence of any dependency on __GNUC__):
>
> # if __WORDSIZE == 64
> typedef long int int64_t;
> # else
> __extension__
> typedef long long int int64_t;
> # endif
>
> But (on one #ifdef branch) sys/types.h says:
>
> # ifdef __GNUC__
> __extension__ typedef long long int int64_t;
> # endif

        Yes, I've got that.
 
> That means when using non-gcc compilers with these headers,
> it depends on the order of #include's (sys/types.h first or
> stdint.h first) whether int64_t is available or not. I
> therefore decided not to depend on stdint.h.

        Fair enough.
 
> The preprocessor conditions look for one of the <limits.h>
> macros for "long long". Note that gcc defines these
> only when special #defines are given. Try -D_GNU_SOURCE.

Now it doesn't recognize long long constants :->

----------------------------------------------------
[root_at_pelican] ~/links/flx>g++ -Wno-long-long -D_GNU_SOURCE -ansi
-pedantic -Iboost_1_22_0 tmp.cpp
In file included from tmp.cpp:1:
boost_1_22_0/boost/cstdint.hpp:149: too many `l's in integer constant
boost_1_22_0/boost/cstdint.hpp:160: #error defaults not correct; you
must hand modify boost/cstdint.hpp
--------------------------------------------------

The test file tmp.cpp is:
-------------------------------------
#include <boost/cstdint.hpp>
//#include <stdint.h>
int main()
{
  boost::int64_t i = 1;
  boost::uint64_t u = 1;
  return 0;
}
-----------------------------------------

What I might do is this:

#ifdef BOOST_NO_INT64_T
namespace boost {
  typedef long long int64_t;
  typedef unsigned long long uint64_t;
}
#endif

The problem is that it won't work if long long
isn't defined. But it will fix the problem temporarily
for the demo, which only works on Linux anyhow.

-- 
John (Max) Skaller, mailto:skaller_at_[hidden]
10/1 Toxteth Rd Glebe NSW 2037 Australia voice: 61-2-9660-0850
checkout Vyper http://Vyper.sourceforge.net
download Interscript http://Interscript.sourceforge.net

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk