Message173270
> If on some platform (uintptr_t)NULL != 0, then some other address can be
> reflected to 0.
This doesn't seem very likely, since then the C implementation wouldn't roundtrip when converting that other pointer to an integer and back to a pointer. (C99 6.3.2.3 says that (void *)0 is a null pointer constant.)
The code you removed is not undefined behaviour, and is not just an optimization---removing it would change the semantics of PyLong_FromVoidPtr. There may be code that depends on PyLong_FromVoidPtr(NULL) being 0. I believe the code should stay.
> What about (Py_uintptr_t)p - (Py_uintptr_t)(void *)NULL?
What about it? What's the relevance to this issue? |
|
Date |
User |
Action |
Args |
2012-10-18 14:03:33 | mark.dickinson | set | recipients:
+ mark.dickinson, serhiy.storchaka |
2012-10-18 14:03:33 | mark.dickinson | set | messageid: <1350569013.6.0.550534957781.issue16277@psf.upfronthosting.co.za> |
2012-10-18 14:03:33 | mark.dickinson | link | issue16277 messages |
2012-10-18 14:03:33 | mark.dickinson | create | |
|