Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #6254

two objects in global scope have the same name

From "Mark" <mark_cruzNOTFORSPAM@hotmail.com>
Newsgroups comp.lang.c
Subject two objects in global scope have the same name
Date 2011-06-17 12:32 -0400
Organization Aioe.org NNTP Server
Message-ID <itfvi6$t8f$1@speranza.aioe.org> (permalink)

Show all headers | View raw


Hello,

consider the following snippet:

struct foo_struct {
   int a;
   int b;
};

struct foo_struct *foo;
struct foo_struct foo_global;

int foo(int x)
{
  ....
  return 0;
}

int main(void)
{
   foo = &foo_global;
  ...
}

So I have two identifiers but for diferent objects (is it correct to call 
function as object?).  Is this stricly illegal, or the standard defines such 
case as "undefined behavior". What part of the standard describe this?

Thanks.


Back to comp.lang.c | Previous | Next — Next in thread | Find similar | Unroll thread


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