[Python-Dev] ANSI strict aliasing and Python
Sat, 19 Jul 2003 14:07:14 +0100
Martin v. L÷wis wrote:
> Ben Laurie <firstname.lastname@example.org> writes:
>>>So if you convert two pointers to the same PyIntObject to PyObject*,
>>>and convert them back, then compare them, you are guaranteed to get
>>>true. If you compare them while they are PyObject*, no guarantees are
>>FWIW, K&R 2nd Ed. says in A6.6 that this is only true if the conversion
>>is to a type whose alignment requirement is less or equally strict.
> What is "this" in your message? "no guarantees are given", or "you are
> guaranteed to get true". If the latter: Sure, but 6.2.5p26 says
Sorry, "this" is the conversion to some other pointer type and back
yielding the same value.
> # All pointers to structure types shall have the same representation
> # and alignment requirements as each other.
> So all pointers are equal.
All pointers to structures, sure.
"There is no limit to what a man can do or how far he can go if he
doesn't mind who gets the credit." - Robert Woodruff