Not logged in
Log in now
Create an account
Subscribe to LWN
LWN.net Weekly Edition for May 23, 2013
An "enum" for Python 3
An unexpected perf feature
LWN.net Weekly Edition for May 16, 2013
A look at the PyPy 2.0 release
Or better yet don't cast at all. %td for printf can take a ptrdiff_t, which is what such a subtraction should usually yield.
would using casts fix the problem?
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