Wolfgang Roemer  wrote on 06/10/2005 12:03:39:
> Hello Michael,
>
> first of all: Thanks for the fast reply!
>
> On Thu Oct 06, 2005 10:33, you wrote:
> >> [..]
> >>
> >>  It's a feature. It is undefined behavior to have conflicting
declarations
> >>  in different translation units.
> >>  [...]
>
> Well, but shouldn't there at least be a warning during linking!?

I am not a gcc developer, but as a user I can see the benefits of this.

>
> >> [..]
> >>  In that case, how does VC++ implement cout,cin,.... construction?
[....]
>
> I don't know how VC++ implements cout, cin. I just checked the symbol
names
> with the dumpbin.exe tool that is part of the VC++ Suite and there it is
> clearly marked as "maximum (int)". And during the attempt to link you get
a
> unresolved symbol error saying that main.o needs "maximum (double)" but
lib
> only offers "maximum (int)" and that's very helpful. I encountered this
> behaviour on Linux because of a very strange SEGV and I was finally able
to
> track that down to an extern variable that was used in the wrong way and
thus
> I found the mentioned behaviour. I did not take a look at the VC++ libc
> implementation etc. I just checked it from the user perspective.
>

It sounds as if the symbol is still "maximum" and it is annotated with
its type (something like debug information). I should be possible to
hack the linker to emit a warning for symbols with conflicting debug
information.

This is the wrong list for linker enhancements. You should look for
binutils mailing lists. However "collect2" which is part of gcc and is
called before the linker (for C++)- could also detect this and give
the same warning. I would bet that collect2 is the wrong place for
this enhancement because it will work only for C++, not for C.

  Michael

Reply via email to