'for every' and 'for any'

Tim Peters tim.one at comcast.net
Tue Jun 4 19:50:17 EDT 2002


[Andrae Muys]
> Now I just don't understand how this position can possibly make sense?
> C dosn't have any 32-bit int types standardised, so what do _you_ use
> when you need one?  Please don't tell me you don't use int, or I'll
> have to hunt you down and put you out of your misery ;).

[Martin Sjögren]
> Doesn't C99 specify <stdint.h>?

Yes.

> With int8_t, int16_t, ..., uint8_t, uint16_t, ...

Not necessarily.  All of the exact-size stdint gimmicks are optional -- an
implementation need not supply any of them.  This simply reflects reality.
There's a slew of other names, like int_least8_t and int_least32_t, that are
required, and those guarantee to resolve to an integer type *at least* big
enough.

In the Python source, we spell int_least32_t "long", since even C89 required
that the platform long hold at least 32 bits' worth of stuff.  People who
think they need a type exactly N bits wide are people who've never thought
about it, or are missing some neurons <wink -- but >= N is easy to live with
provided you're not trying to optimize for space, or relying on woefully
unportable casting tricks).

Well, OK, the Python source does assume in several places that "a byte" is
an 8-bit thingie.  The saving grace there is that any platform on which
that's false will never get popular enough to attract a significant user
base.

19-bit-microcomputers-are-a-thing-of-the-past-ly y'rs  - tim







More information about the Python-list mailing list