[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Caveat with lua_pushlightuserdata(L, (void *)&key)
- From: Mike Pall <mikelu-0606@...>
- Date: Mon, 26 Jun 2006 11:23:52 +0200
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.