I dislike union tricks in general, but then again I dislike warnings left in the code. Given all things, I think in this case the SP_OBJECT () macro gives us the better code legibility.
However, if it comes down to a hotspot that is measured to give problems, then the union work-around would be more appropriate as long as it actually made a measured difference in performance testing. Just wanted to make sure that everyone else was aware of the factors I was considering, and that sometimes using the union like that might be warranted. (but again, we should strive for code legibility first)
Good that you say that. I have looked at the code behind SP_OBJECT(), and they just move the problem into a function elsewhere. Also, this resolved only the cases casting from void* to SPObject*. For the rest, which is code in util/glib-list-iterators.h and gc-soft-ptr.h, the macro will not suffice.
ralf