comp.lang.ada
 help / color / mirror / Atom feed
From: Keith Thompson <kst-u@mib.org>
Subject: Re: how to know sizeof(int)
Date: Sat, 07 Aug 2004 04:09:14 GMT
Date: 2004-08-07T04:09:14+00:00	[thread overview]
Message-ID: <lnbrhn613p.fsf@nuthaus.mib.org> (raw)
In-Reply-To: gpqsec.gp1.ln@skymaster

"Jean-Pierre Rosen" <rosen@adalog.fr> writes:
> "Ludovic Brenta" <ludovic.brenta@insalien.org> a �crit dans le
> message de news:87llguk9k1.fsf@insalien.org...
> > Indeed, hidden assumptions are evil, and the Enlightened Ones use
> > System.Storage_Unit instead of just "8".  Somehow, "8" is too short to
> > type and read :)
> Sure, but we are in a C context here. Try to explain to a C
> programmer that a byte does not necessarily have eight bits :-)

To a C programmer, a byte doesn't necessarily have 8 bits.  The C
standard guarantees that a byte is *at least* 8 bits, but there are
systems with larger bytes (I think 32 is typical for DSPs).

In C, the number of bits in a byte is determined by the macro CHAR_BIT
in <limits.h>.

You can't necessarily assume that C's CHAR_BIT is the same as Ada's
System.Storage_Unit, but I'd be very surprised to see a system where
they're different.

-- 
Keith Thompson (The_Other_Keith) kst-u@mib.org  <http://www.ghoti.net/~kst>
San Diego Supercomputer Center             <*>  <http://users.sdsc.edu/~kst>
We must do something.  This is something.  Therefore, we must do this.



  reply	other threads:[~2004-08-07  4:09 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-08-04 14:58 how to know sizeof(int) Evangelista Sami
2004-08-04 15:18 ` Eric Jacoboni
2004-08-04 15:26 ` Adrian Knoth
2004-08-04 15:32 ` Jean-Pierre Rosen
2004-08-04 19:06   ` Ludovic Brenta
2004-08-05  8:14     ` Jean-Pierre Rosen
2004-08-07  4:09       ` Keith Thompson [this message]
2004-08-04 21:52   ` Adrian Knoth
2004-08-05  8:16     ` Jean-Pierre Rosen
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox