[cfe-dev] warnings in clang

Mike Stump mrs at apple.com
Fri Nov 14 16:46:00 PST 2008


On Nov 14, 2008, at 4:29 PM, Sebastian Redl wrote:
>> As I read that, it sounds like someone is praying and hoping and  
>> violating the language standard.  Don't do that.  We don't trick  
>> gcc into not complaining, if you do that, you _will_ lose.  One  
>> _must_ write code that is type safe.  That isn't a trick.  I  
>> reviewed lib/Bitcode/Reader/Deserialize.cpp  
>> Deserializer::ReadUIntPtr.  :-(  I don't see anything that is type  
>> safe about this code.
> Huh? So, it isn't a trick and indeed legal?

If by it, you mean playing with the addresses of memory, yes, that is  
legal.  You can play all you want with the address, no harm will come  
of it.  That _part_ isn't a trick and is valid.

If you mean, can you then use those addresses after playing with  
them.  Yes, provided that the type of access is the same.  In the case  
of ReadUIntPtr, it is wrong, the type is different, as I have said.



More information about the cfe-dev mailing list