On 29 Mar 2011, at 01:01, David Chisnall wrote:

> This bug is completely hidden by the tangle of defines in GSIMap.h, in 
> combination with the GCC cast-to-union extension.  I'm not really convinced 
> that GSIMap should be used directly anywhere - if we'd used NSMapTable then 
> this bug would not have existed, because all keys and values would have been 
> cast to pointer-sized quantities, and the compiler would have warned us when 
> we were doing a bad cast.  


Additionally, the C spec does not actually define the behaviour of storing a 
value of one type in a union and then accessing another type, so an 
implementation is entirely free to do whatever it wants with this code.  

As an implementation detail, most C implementations will retrieve the same bit 
pattern, making it the equivalent of a pointer cast, but this is not required 
behaviour.  Some type-checking implementations will raise errors if you try to 
do this.

David

-- Sent from my Apple II
_______________________________________________
Gnustep-dev mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/gnustep-dev

Reply via email to