>Subject: Re: passing char* data >From: John Marshall <[EMAIL PROTECTED]> >Date: Thu, 30 May 2002 21:02:51 +0200
>On Thu, May 30, 2002 at 01:48:09PM -0400, Stringer wrote: >> Nope. The only size requirement is sizeof(short) <= sizeof(long) >> There's no set size for 'short', 'int' or 'long' >> >> And there's no gaurentee of sizeof(short) <= sizeof(int) >> or of sizeof(int) <= sizeof(long) >> >> In theory 'int' could be larger than 'long' or smaller than 'short', though >> all processors you are currently likely to run into seem to have >> sizeof(short) <= sizeof(int) <= sizeof(long) > >Uh... okay, if we're going to be pedantic, and if we're going to worry >about this stuff, let's be *right*. (In the following, I'm going to >simplify by assuming that we're dealing with the binary two's-complement >layouts we all know and love.) > >Standard C and C++ provide the following guarantees, except that >"long long" does not exist in standard C++: > > |char| >= 8 bits > |short| >= 16 bits > |int| >= 16 bits > |long| >= 32 bits > |long long| >= 64 bits > > |char| <= |short| <= |int| <= |long| <= |long long| > >ISO/IEC 9899:1999 (the C99 standard) specifies the minimum sizes for >each type in section 5.2.4.2.1 and the progression amongst them in >sections 6.2.5/8 and 6.3.1.1. OK John. Glad they fixed the definitions. A loooong time ago I worked on a system where 'int' was 8 bits, and both 'short' and 'long' were 16 bits. Got caught out pretty badly until I realized how small the 'int' was! That kind of experience can sear things into your brain. Roger Stringer Marietta Systems, Inc. -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
