Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | "Mark" <mark_cruzNOTFORSPAM@hotmail.com> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: two objects in global scope have the same name |
| Date | 2011-06-19 14:07 -0400 |
| Organization | Aioe.org NNTP Server |
| Message-ID | <itldua$su5$1@speranza.aioe.org> (permalink) |
| References | <itfvi6$t8f$1@speranza.aioe.org> <chine.bleu-D062AE.20523717062011@news.eternal-september.org> <iti716$ams$1@speranza.aioe.org> <itid0a$i4g$1@dont-email.me> |
Hello
Thanks a lot for comments.
"James Kuyper" <jameskuyper@verizon.net> wrote in message
news:itid0a$i4g$1@dont-email.me...
> 6.9p5:
>> ... If an identifier declared with external
>> linkage is used in an expression (other than as part of the operand of a
>> sizeof operator
>> whose result is an integer constant), somewhere in the entire program
>> there shall be
>> exactly one external definition for the identifier; otherwise, there
>> shall be no more than
>> one.
>
> Those "shall"s occur outside of a constraint section. Code which
> violates them therefore has undefined behavior (4p2). That means that
> the C standard imposes no requirements on what the implementation does
> with your code. In principle, that means that just about anything can
> happen.
>
Consider this snippet:
a.h:
extern int x;
a.c:
#include "a.h"
int x;
b.h:
extern long x(void);
b.c:
#include "b.h"
long x(void)
{
return 1;
}
How does the Standard interpret this case? I think that 6.9.1p6 applies to
this case, and results in underfined behavior as well ?
Thanks.
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
two objects in global scope have the same name "Mark" <mark_cruzNOTFORSPAM@hotmail.com> - 2011-06-17 12:32 -0400
Re: two objects in global scope have the same name Shao Miller <sha0.miller@gmail.com> - 2011-06-17 13:08 -0500
Re: two objects in global scope have the same name pete <pfiland@mindspring.com> - 2011-06-17 23:10 -0400
Re: two objects in global scope have the same name Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2011-06-17 23:43 -0600
Re: two objects in global scope have the same name James Kuyper <jameskuyper@verizon.net> - 2011-06-18 10:16 -0400
Re: two objects in global scope have the same name China Blue Angels <chine.bleu@yahoo.com> - 2011-06-17 20:52 -0700
Re: two objects in global scope have the same name "Mark" <mark_cruzNOTFORSPAM@hotmail.com> - 2011-06-18 08:51 -0400
Re: two objects in global scope have the same name James Kuyper <jameskuyper@verizon.net> - 2011-06-18 10:33 -0400
Re: two objects in global scope have the same name "Mark" <mark_cruzNOTFORSPAM@hotmail.com> - 2011-06-19 14:07 -0400
Re: two objects in global scope have the same name James Kuyper <jameskuyper@verizon.net> - 2011-06-20 06:36 -0400
Re: two objects in global scope have the same name China Blue Angels <chine.bleu@yahoo.com> - 2011-06-18 08:12 -0700
csiph-web