while true: !!!

Greg Jorgensen gregj at pobox.com
Wed Dec 20 01:08:20 EST 2000


"Alex Martelli" <aleaxit at yahoo.com> wrote in message
news:91of2t01um1 at news2.newsguy.com...
> If you mean 'char is a numeric type' (in C but not Python),
> ...
> I don't know of any distinction drawn _in C_ between
> 'integer' and 'non-integer' numeric types, that would make
> 'integer' somehow a significant C term -- am I just having
> a brainstorm...?).

You're having a brainstorm. There is definitely a distinction between
integer and non-integer types in C. And char is most definitely an integer
type.

C has four integer types that may be signed or unsigned: char, short, int,
long. In K&R C They do not have to be different sizes; the definition only
requires that sizeof(char) <= sizeof(short) <= sizeof(int) <= sizeof(long).
Typical x86 compilers have 8-bit chars, 16-bit shorts, 16- or 32-bit ints,
and 32-bit longs. K&R says that the integer types should map to the
"natural" sizes for the host hardware. ANSI C specifies minimum ranges for
the integer types.

K&R C has two floating-point types: float and double. ANSI C added long
double. Again K&R only requires that the precision of float <= precision of
double, and ANSI C defines minimum precisions.

Just some of the differences between integer and floating-point types: The
results of bitwise operators are only defined for int types. Bit fields must
be one of the int types. ANSI C only allows integer types as the switch(
... ) condition. And so on.

--
Greg Jorgensen
Deschooling Society
Portland, Oregon, USA
gregj at pobox.com





More information about the Python-list mailing list