[LLVMdev] LLVM 2.4 problem? (resend)
clattner at apple.com
Wed Oct 15 08:28:14 PDT 2008
On Oct 15, 2008, at 6:58 AM, Tatu Vaajalahti wrote:
>> Yes, but why do you think they should get a different address? I can
>> understand that it is surprising that they do, but determining
>> this is legal or not requires reading the language standard.
>> a language lawyer can chime in and say whether this transform is
>> 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.
GCC does the same things with strings in some cases. You shouldn't
depend on this behavior if you want portable code. If you avoid
marking the global variable const, you should have better luck.
More information about the llvm-dev