Divick Kishore wrote: > Hi Marcus, > thanks for the reply. > >>>Yes, the warning is totally ignorable. We've been running with it >>>disabled for over a year now. :) > > Still that does not answer why VC7 gives those errors ? From a language > semantics perspective what really is wrong with that line?
VC7.1 isn't very ISO C++ conformant, although it a lot better than it's predecessors. I'm not 100% sure but I think that extern wasn't in the standard when they released 7.1, hence the compiler warns that you are using something that's not in the standard (Or the MSVC-dev team didn't have time to fix it, VS71 is not exactly a thoroughly tested and overworked product). The warning is quite nice, but since the compiler has another slew of isses that are not standard which it doesn't warn for, this one makes little sense. The 'extern' keyword was meant to be used to define that the template specialization is instantiated in another compilation unit (i.e. cpp-file), rather than the current one, to avoid code-bloat of each .cpp generating code for, say, std::vector<int>. (This is reduced to one set of machine-code by the linker, so it only affects the size of your .obj-files.) So, this is all very nice in theory, but due to some issues with the template instantiation mechanism (I can't remember the details, but I think Herb Sutter wrote an article about it, search on www.gotw.ca) it doesn't really work as intended anyway. I think Visual 8 gives the warning: "'extern' keyword not supported." instead, but I'm not sure. I do know that neither VC7 nor VC8 implements it properly (I recall reading it in the docs) and that you still get the correct code (OpenSG runs fine on both VC7 and VC8), it justs take longer to compile and link. When I want to do something like 'extern' and get results, I usually end up with putting the template-source in the cpp-file and doing explicit instantiation there, for all types that my executable will need. This means two things: 1. no inlining. 2. all template functions get instantiated, not just the ones that are used (this can be serious since some of your templated class's functions might only compile with certain types, etc.). Perhaps the gcc guys have managed to get it to work properly (or at least for OpenSG's application thereof) so that would also explain the difference in compile speed for OpenSG on *nix vs. windows/msvc, as well as why extern is being used. Cheers, /Marcus Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ Opensg-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/opensg-users
