Re: structures with the same name are messed up

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

 



On 2014. April 25. 12:53:54 Markus Trippelsdorf wrote:
> You're violating the "one definition rule". It states that you can
> define the same struct in different translation units, provided it
> consist of the same sequence of tokens, otherwise the behavior is
> undefined as in your example.

Ok, you are right.
But my problem is that those definitions come from two independent sources 
using the same library and do not know each other.
I do not see a solution to solve it, but at least detecting this situation 
would be useful.

nm -C a.o b.o

a.o:
0000000000000000 T test_a(int)
0000000000000000 W Checker<test>::mySize()

b.o:
0000000000000000 T test_b(int)
0000000000000000 W Checker<test>::mySize()

There are two different functions having the same name and parameter list: why 
the linker do not send at least a warning message about it? If I define such 
(e.g. other test_a() function again) then it results in a linker error. Why 
those mySize() functions not?

Regards
Gyorgy Kovesdi







[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