SIZEOF

Guy Harris guy at rlgvax.UUCP
Sat Jan 19 14:59:32 AEST 1985


>  K&R page 192 first paragraph:
> 
>    "The compilers currently allow a pointer to be assigned to an integer,
> an integer to a pointer, and a pointer to a pointer of another type.
> THE ASSIGNMENT IS A PURE COPY OPERATION, WITH NO CONVERSION. ...
> 
> This says to me that the sizes must be the same. Changing the size is
> a conversion in my eye. ...

Under "Explicit pointer conversions", p. 210:

	A pointer may be converted *to any of the integral types
	large enough to hold it.  Whether an "int" or "long" is required
	is machine dependent.*  ("Italics" mine.)

Note that "integer" does not mean "int".  "4. What's in a name", last
paragraph, p. 182:

	Up to three sizes of integer, declared "short int", "int", and
	"long int", are available.

So what they meant to say on p. 192 was that a pointer may be assigned
to an integer large enough to hold it.  On some machines, "int" may not
be large enough to hold a pointer, and "long int" is the only integer
to which a pointer may be assigned.

	Guy Harris
	{seismo,ihnp4,allegra}!rlgvax!guy



More information about the Comp.lang.c mailing list