C Floating point arithmetic

Andrew Koenig ark at alice.UucP
Sat Dec 7 00:15:22 AEST 1985


>> K+R says you can convert any pointer to an int and back again without
>> wrecking it.

> That is NOT what it says.

No, it's not quite, but it's extremely close.  Page 210, sec. 14.4:


	A pointer may be converted to any of the integral types
	large enough to hold it.  Whether an int or a long is
	required is machine dependent.  The mapping function
	is also machine dependent, but is intended to be unsurprising
	to those who know the addressing structure of the
	machine.  Details for some particular machines are
	given below.

	An object of integral type may be explicitly converted
	to a pointer.  The mapping always carries an integer
	converted from a pointer back to the same pointer,
	but is otherwise machine dependent.

Thus, you can convert any pointer to a long and back again without
wrecking it, and you can use an int instead of a long on some machines.



More information about the Comp.lang.c mailing list