This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Function redefined
- From: Amit Choudhary <amit2030 at yahoo dot com>
- To: gcc-help at gcc dot gnu dot org
- Date: Thu, 19 Aug 2004 23:49:08 -0700 (PDT)
- Subject: 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