469,963 Members | 1,203 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,963 developers. It's quick & easy.

static and extern "C" function with the same name

a.cxx

extern int b();
static int a();
int main()
{
b();
return a();
}
static int a(){return 1;};
b.cxx
int a()
{ return 2;}
int b()
{ return 3;}

$ c++ a.cxx b.cxx
$ ./a.out
$ echo $?
1

Is returning 1 guaranteed for this program?

May 17 '07 #1
1 1405
On 16 May 2007 22:28:16 -0700, Alok Kumar <al********@gmail.com>
wrote in comp.lang.c++:
a.cxx

extern int b();
static int a();
int main()
{
b();
return a();
}
static int a(){return 1;};
b.cxx
int a()
{ return 2;}
int b()
{ return 3;}

$ c++ a.cxx b.cxx
$ ./a.out
$ echo $?
1

Is returning 1 guaranteed for this program?
Yes.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://c-faq.com/
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.club.cc.cmu.edu/~ajo/docs/FAQ-acllc.html
May 18 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Jahn Otto Næsgaard Andersen | last post: by
29 posts views Thread by Alexander Mahr | last post: by
1 post views Thread by sbmoon | last post: by
12 posts views Thread by dual0 | last post: by
6 posts views Thread by Ravi | last post: by
40 posts views Thread by vishnu | last post: by
4 posts views Thread by dolphin | last post: by
1 post views Thread by rainxy | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.