[C++-sig] boost/python 1.33.1 breaks aliasing rules

Philipp Thomas pth at suse.de
Thu Dec 8 18:01:16 CET 2005


* David Abrahams (dave at boost-consulting.com) [20051208 07:06]:

> Which, AFAICT, means that our casts aren't hurting anybody, regardless
> of whether we use -fno-strict-aliasing.  Right?

Right. Do you have an idea how to pass -fno-strict-aliasing *only* when
build libboost_python?

> where the union performs, essentially, a reinterpret cast of a PyObject*&
> to a PyTypeObject*&, which could be a completely different thing.

Please? I'm still passing a PyObject*, as the union is essentially a
reinterpret_cast<PyObject *>(PyTypeObject *).
 
> I would strongly oppose the former, 

There's no disagreement as I hate #ifdef because it always makes code nearly
unreadable.

> but the latter might be no worse
> (and may be a little better) than leaving the C-style casts in there.

Hmm, I'll try to come up with a way to encapsulate it in macros.

Philipp



More information about the Cplusplus-sig mailing list