This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Function redefined


Hi All,

I am writing a program that includes <stdlib.h>. int atoi(const
char *) is declared in that header file. I am defining (not
declaring) atoi again in my program and using it.

As I know, standrd C library (libc.so) is linked with the
program.

1. Doesn't gcc find the definition twice and shouldn't it report
the error?

What I found was that it uses the first definition found.

2. Was it always like this or sometime during the course of
evolution of compilers, it was decided that the first definition
would be used?

3. Or, since it is compiled with dynamic library, it is behaving
that way?

4. Would compiling it with static C library (libc.a) would give
me a "function redefined" error?

Any help would be appreciated a lot as I have become involved in
a heated discussion regarding this.

Regards,
Amit



		
_______________________________
Do you Yahoo!?
Win 1 of 4,000 free domain names from Yahoo! Enter now.
http://promotions.yahoo.com/goldrush


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]