[LLVMdev] LLVM 2.4 problem? (resend)

Tatu Vaajalahti tatuvaaj at mac.com
Wed Oct 15 06:58:27 PDT 2008


On 15.10.2008, at 16.43, Duncan Sands wrote:

>> True, but note that it is the address of a variable that is used, not
>> the value.
>
> Yes, but why do you think they should get a different address?  I can
> understand that it is surprising that they do, but determining whether
> this is legal or not requires reading the language standard.   
> Hopefully
> a language lawyer can chime in and say whether this transform is valid
> or not.


I agree the whole construction is a litle bit strange (stupid even).  
It is however common way to specify context identity in one Objective- 
C pattern (although I don't think anyone actually uses initialized  
const variables, I was just playing with them to see how compilers put  
stuff in segments).

I do think however that it's bit dangerous to combine static constants  
across compilation units.


---
Tatu Vaajalahti
Tampere, Finland









More information about the llvm-dev mailing list