Not logged in
Log in now
Create an account
Subscribe to LWN
An unexpected perf feature
LWN.net Weekly Edition for May 16, 2013
A look at the PyPy 2.0 release
PostgreSQL 9.3 beta: Federated databases and more
LWN.net Weekly Edition for May 9, 2013
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