[LLVMdev] MCStreamer interface
Dale Johannesen
dalej at apple.com
Wed May 5 14:45:35 PDT 2010
On May 5, 2010, at 2:32 PMPDT, Nathan Jeffords wrote:
>
> Global definitions like "int x;" are treated as common to allow
> linking buggy programs that forget to use "extern" on declarations.
>
> Is this always the behavior, or only when certain options are set? This seems like a violation of the language standard.
Technically yes; the original K&R C book had the one-definition rule in it. Early C compilers did not work this way, however, and by the time that book was published (1978) there was already a large body of code that assumed the "common" model (also Ritchie's preference, I believe). In practice most compilers still default to this model because a lot of widely used stuff will break if they don't, and the behavior is given in J.5.11 of C99 as a common extension.
Use -fno-common to turn it off.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100505/9ea61ead/attachment.html>
More information about the llvm-dev
mailing list