[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: NSConnection bugs
From: |
David Chisnall |
Subject: |
Re: NSConnection bugs |
Date: |
Tue, 29 Mar 2011 11:10:00 +0100 |
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
- NSConnection bugs, David Chisnall, 2011/03/28
- Re: NSConnection bugs,
David Chisnall <=