[C++-sig] boost/python 1.33.1 breaks aliasing rules (original) (raw)
Philipp Thomas pth at suse.de
Mon Dec 5 12:07:23 CET 2005
- Previous message: [C++-sig] boost/python 1.33.1 breaks aliasing rules
- Next message: [C++-sig] boost forward declaration error
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
- Ralf W. Grosse-Kunstleve (rwgk at yahoo.com) [20051201 18:42]:
Thanks for pointing out the aliasing problems! Could you help us understanding how the problem could be fixed? E.g., this is the code in str.cpp: return (detail::newreference)PyObjectCallFunction( (PyObject*)&PyStringType, "(O)", arg.ptr()); Line 12 is (PyObject*)&PyStringType. Is this what we have to look at?
Yes, the cast is what triggers the warning. C aliasing rules say, that basically an object may only be accessed by a pointer of the same type. Only char or void pointers may point to anything. These rules also apply to C++, of cause expanded by the needs of C++.
AFAICS, PyObject and PyString_Type aren't related types, i.e. somehow derived from one another.
Both types are defined in Python headers. AFAIK the cast above is standard practice in Python code...
Yes, that's because up until now no compiler complained.
Philipp
- Previous message: [C++-sig] boost/python 1.33.1 breaks aliasing rules
- Next message: [C++-sig] boost forward declaration error
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]