Re: [Boost-bugs] [Boost C++ Libraries] #3548: Comeau C++ reports global scope has no int64_t

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #3548: Comeau C++ reports global scope has no int64_t
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2009-11-14 23:37:33


#3548: Comeau C++ reports global scope has no int64_t
------------------------------------------+---------------------------------
 Reporter: mloskot <mateusz@…> | Owner: dlwalker
     Type: Bugs | Status: new
Milestone: Boost 1.41.0 | Component: integer
  Version: Boost Development Trunk | Severity: Problem
 Keywords: comeau,como |
------------------------------------------+---------------------------------

Comment(by mloskot <mateusz@…>):

 Thanks it como's option ''--list'', I confirmed that in the first case
 that fails to compile uint64_t is not defined indeed. Preprocessed source
 of the program shows that first header ''/usr/include/sys/types.h'' is
 included and it consits of this:

 {{{
 /* These types are defined by the ISO C99 header <inttypes.h>. */
 # ifndef __int8_t_defined
 # define __int8_t_defined
 typedef char int8_t;
 typedef short int int16_t;
 typedef int int32_t;
 # if __WORDSIZE == 64
 typedef long int int64_t;
 # elif __GLIBC_HAVE_LONG_LONG
 __extension__ typedef long long int int64_t;
 # endif
 # endif
 }}}

 causing the following effects:
  * WORDSIZE == 64 is false, so uint64_t is not defined
  * _ _ GLIBC_HAVE_LONG_LONG is not defined, so second try to define
 uint64_t is not performed
  * ''_ _ int8_t_defined'' is eventually defined

 Next, ''/usr/include/stdint.h'' is included and it consits some repeated
 definitions from ''sys/types.h'', but with slight difference:

 {{{
 /* There is some amount of overlap with <sys/types.h> as known by inet
 code */
 #ifndef __int8_t_defined
 # define __int8_t_defined
 typedef signed char int8_t;
 typedef short int int16_t;
 typedef int int32_t;
 # if __WORDSIZE == 64
 typedef long int int64_t;
 # else
 __extension__
 typedef long long int int64_t;
 # endif
 #endi
 # endif
 }}}

 However, these definitions are not enabled because ''_ _ int8_t_defined''
 has been already defined by ''sys/types.h'',
 so, what's most important here, int64_t type is not defined.

 The slight difference I mentioned above seems to be important:

 {{{
 # elif __GLIBC_HAVE_LONG_LONG
 __extension__ typedef long long int int64_t;
 # endif
 }}}

 versus

 {{{
 # else
 __extension__
 typedef long long int int64_t;
 # endif
 }}}

 To summary, if ''stdint.h'' would get first, int64_t was defined.

 Also, the slight difference in testing vs no testing ''_ _
 GLIBC_HAVE_LONG_LONG'' seems to be an inconsistency in standard headers
 and may look like a bug, so I'm going to try to confirm it.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/3548#comment:3>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:01 UTC