Re: extern
- From: Mark McIntyre <markmcintyre@xxxxxxxxxxx>
- Date: Fri, 22 Jul 2005 00:01:10 +0100
On Wed, 20 Jul 2005 13:39:13 +0100, in comp.lang.c , Lawrence Kirby
<lknews@xxxxxxxxxxxxxxx> wrote:
>On Wed, 20 Jul 2005 12:03:08 +0100, Mark McIntyre wrote:
>
>> On Tue, 19 Jul 2005 21:43:12 -0500, in comp.lang.c , Jack Klein
>> <jackklein@xxxxxxxxxxx> wrote:
>>
(of two files with int a; in them)
>>>If you compile these two source files and combine them into a single
>>>executable, you produce undefined behavior.
>>
>> You sure? The second behaves exactly as if it had been declared
>> extern int a;
>
>Both have identical (external) linkage but their behaviour in terms of
>whether they create a definition is different.
>
>As such both a.c and b.c contain a definition of a so linking them
>produces undefined behaviour.
Really? The standard makes it pretty clear that in the absence of a
storage class specifier, a file-scope object is considered to be
extern. And FWIW I can't recall a compiler that behaves otherwise than
to consider two such declarations to be synonyms. I confess, my
initial thought was the same as yours, but closer reading of the
standard deconvinced me. Can you point me to the actual section that
confirms your view?
--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.ungerhu.com/jxh/clc.welcome.txt>
----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
.
- Follow-Ups:
- Re: extern
- From: Flash Gordon
- Re: extern
- From: Netocrat
- Re: extern
- From: Chris Torek
- Re: extern
- References:
- extern
- From: DevarajA
- Re: extern
- From: Jack Klein
- Re: extern
- From: Mark McIntyre
- Re: extern
- From: Lawrence Kirby
- extern
- Prev by Date: Re: What is the point of signed char?
- Next by Date: Re: What is the point of signed char?
- Previous by thread: Re: extern
- Next by thread: Re: extern
- Index(es):
Relevant Pages
|