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!? >> [..] >> In that case, how does VC++ implement cout,cin,.... construction? >> In libstdc++ (well, at least in gcc-3.4) it is implemented by doing >> something like: >> >> namespace std{ >> ... >> >> // Note that this is different from <iostream>'s definition of cin >> // (it's declared as "extern istream cin" in there). >> char cin[ sizeof(istream) ]; >> ... >> ios::Init::Init() >> { >> if (count++ == 0) >> new (&cin) istream(cin_constuction_flags); >> .... >> } 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. Thanks, WR