This is the mail archive of the egcs@egcs.cygnus.com mailing list for the EGCS project. See the EGCS home page for more information.


[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index] [Subject Index] [Author Index] [Thread Index]

Re: `quad' printf format specifier ?




  In message <Pine.LNX.4.05.9902081606350.164-100000@lo-pc3035a.hitc.com>you wr
ite:
  > Assuming that >= means greater *or* equal to, are you saying that given
  > 'long long' is 64 bits then 'long', 'int', 'short' and 'char' can also be
  > 64 bits in certain circumstances? 
I believe they can.  I'm not aware of any such target, but I do not think it
is disallowed by the standard.

I believe the wording typically sounds like a "char is large enough to hold
a character on the target machine" or something like that.

I'm not a language lawyer though.

  > If that's correct, the expression 'Oh bugger!' is something that comes to
  > mind. What's the best way to ensure that you get datatypes of a given
  > bit-length in C/C++?
I'm not sure if there is -- ISO may (or may not) have defined types for
specific sizes.

You can play these kinds of games:

#if UCHAR_MAX == 255
typedef unsigned char uint8;
typedef signed char int8;
#else
#error "Char is not an 8-bit type"
#endif




  > OK, this is getting off-topic for the egcs mailing list, time to take this
  > to comp.lang.c or .c++.
Yup.


jeff