Whose code should we break? ( was Re: 64 bit C )
Doug Gwyn
gwyn at smoke.brl.mil
Thu Feb 21 09:47:15 AEST 1991
In article <5768:Feb2020:29:0091 at kramden.acf.nyu.edu> brnstnd at kramden.acf.nyu.edu (Dan Bernstein) writes:
>I find it strange that the standard insisted that some integral type be
>big enough for a pointer. That rule is entirely useless without a way to
>figure out what the integral type is.
No, but it does mean that strictly conforming programs should not make
assumptions here. If you want to print a pointer value as an integer
rather than using %p, I suggest casting it to long (or unsigned long).
%p is better, if you can assume that you have a conforming implementation.
For generic pointer arithmetic, char* is better than any integral type.
>Why did ANSI restrict the
>implementor without giving the programmer anything in return?
Many people wanted such a guarantee. I agree that it isn't all that
useful in practice.
More information about the Comp.lang.c
mailing list