Function redefined

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux