[LLVMdev] global question

Eli Friedman eli.friedman at gmail.com
Sat Mar 7 13:10:55 PST 2009


On Sat, Mar 7, 2009 at 11:10 AM, John Regehr <regehr at cs.utah.edu> wrote:
> I don't think you can attach an initializer to an extern except at the
> point where the variable is defined.  But since x is defined here, there
> would then be two definitions of x, a link-time error.

Strictly, that's true, but gcc supports it as an extension.  Variables
like "int x;" are given common linkage, which allows them to be
overridden.

-Eli




More information about the llvm-dev mailing list