This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Two or three initial observations on the fp prining patch


Jerry Quinn wrote:

Paolo Carlini writes:
> Andreas Jaeger wrote:
> > >I would propose unsigned int for uint32_t instead of unsigned long...
> > > >
> I see, because long is 64 bit on 64 bit machines, right? Ok, I have just > re-read
> section 4.2 of your paper for GCC Summit and everything is clear!


Can we rely on (unsigned) int to be 32 bits on all supported
platforms?  If so, great.  The language doesn't require that, though.

Indeed, it doesn't. But it requires at least 16 bits.
So, not many possibilites... 16, 32 (64 seems unlikely to me for int (vs long))


In v2's gen-params there is:

# Figure out integral type sizes.

default_int16='short /* deduction failed */'
default_int32='long /* deduction failed */'
INT16=32767
INT32=2147483647

if [ "${SHRT_MAX}" = $INT16 ] ; then
 default_int16='short /* deduced */'
 if [ "${LONG_MAX}" = $INT32 ] ; then
   default_int32='long /* deduced */'
 elif [ "${INT_MAX}" = $INT32 ] ; then
   default_int32='int /* deduced */'
 fi
fi

So, we can envisage a simple autoconf test for this, including <limits.h> and
computing the answer. How? I didn't know exactly 'til now but then I discovered
this cute way in our current acinclude.m4:


 AC_EGREP_CPP([_GLIBCXX_ok], [
 #include <features.h>
 #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)
 _GLIBCXX_ok
 #endif
 ], enable_clocale_flag=gnu, enable_clocale_flag=generic)

Funny: you define or not a macro and then look for it in the preprocessed code!

Most probably there are other ways, though... Anyone wanting to help? Otherwise
I will look into it more closely myself...


Paolo.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]