lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Richard Ranft wrote:
> This seems like the most annoying case of excessive optimization possible.
> Why on Earth would you want this?  Two static const variables with the same
> value could still represent different purposes - the compiler and linker
> have no business optimizing out your purpose.

Sure, it's pretty pointless to do this for tiny constants. But it
seems to be a logical extension of string constant joining. And
many toolchains have been doing this for a long time (try
printf("%p\n", "foo") from two different source files linked to
the same executable -- you may need to compile with -O).

Maybe someone orthogonalized the linker a bit too much. I still
think it's not forbidden by the various C standards.