> These unions would only be in the calling code, where they can be type
> specific, but I don't like this solution, too.
>
> But what's the best way then? Changing the casts from void** to void*?
> Compile with -fno-strict-aliasing?

The warning is emitted because, when compiling zend_hash_find(), the
compiler didn't expect your void** pData argument to actually be a
zval**, so any zval**s inside the definition of zend_hash_find() are
assumed not to point to the same location as pData.

If you look at the semantics of the function, you will find that this
assumption remains valid, as the void** argument is really the return
value of the hash lookup. No aliasing problems here.

As I said, passing a void* instead of a void** takes care of the warning
but not of the problem. Therefore, you can just pass -Wstrict-aliasing to
suppress the error. The 'correct' way to reimplement this would be to
return the pointer as a result instead of storing it in a location pointed
to
by an argument. The quick fix would be my prior suggestion to change
the prototype and all invocations to be a void*.

Personally, I wouldn't worry about it too much though.

Ard

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to