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 ?



> On Mon, 8 Feb 1999, Jeffrey A Law wrote:
> 
> > No, you can't assume that.  You can assume:
> > 
> > sizeof (long long) >=  sizeof (long) >= sizeof (int) >= sizeof (short) >= sizeof (char)
> 
> 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? 

Correct in theory.

> 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++?

If some object must be a signed, 32-bit type, make a typedef int32 and
use that.  Your code won't run when someone tries to port it to a 24-bit
DSP, but that's life.