Not logged in
Log in now
Create an account
Subscribe to LWN
Pencil, Pencil, and Pencil
Dividing the Linux desktop
LWN.net Weekly Edition for June 13, 2013
A report from pgCon 2013
Little things that matter in language design
Make the printf line
printf("%lu\n", (unsigned long)aend - (unsigned long)a);
would using casts fix the problem?
Posted Apr 16, 2008 20:27 UTC (Wed) by jengelh (subscriber, #33263)
Posted Apr 16, 2008 21:29 UTC (Wed) by MathFox (guest, #6104)
Standard conforming programs don't rely on pointer layout.
Posted Apr 17, 2008 18:55 UTC (Thu) by hummassa (subscriber, #307)
aend - a
(without cast) _is_ 10 in any platform, but
(int)aend - (int)a
is _undefined_ behaviour, because the bit pattern when converting from
pointer to int is implementation-defined.
Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds