From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII X-Google-Thread: fa528,29614d1eab99e09f,start X-Google-Attributes: gidfa528,public X-Google-ArrivalTime: 2001-06-18 12:37:30 PST Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!news.tele.dk!193.174.75.178!news-fra1.dfn.de!news-koe1.dfn.de!news.rhrz.uni-bonn.de!news.uni-stuttgart.de!bland.fido.de!nobody From: tobi@bland.fido.de (Tobias Ernst) Newsgroups: comp.unix.tru64 Subject: cxx annoyance Date: Mon, 18 Jun 2001 20:40:16 MEZ Organization: Fido.De Host Baden-Wuerttemberg Message-ID: <992888612@f1.n7600.z242.fido.de> NNTP-Posting-Host: lilapause.physcip.uni-stuttgart.de Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit X-Comment-To: All X-MailConverter: SoupGate-OS/2 v1.42 Xref: archiver1.google.com comp.unix.tru64:2548 Hallo All! The Compaq cxx compiler (version 6.4, but olders had it as well) on Tru64 has the following very annoying feature: if I do #include "filename.h" and there is a file called "filename.cc", the compiler silently includes "filename.cc" in addition to filename.h into my compilation unit, in situations where the template instantiation code thinks that this might be useful. Is there *any* way to turn this annyoing feature off, other than renaming filename.cc to a name where the Compiler will not find it? I frequently tend to define longer template functions or templated class member functions not in a .h file, but in a .cc file, to keep the .h file short, and only place the declaration in the .h file. Then, of course, I have to explictly instantiate those functions for all template parameters that I intend to use in that separate .cc file and include that separate .cc file into the link process. At least that is what I have to do on all other compilers. But it is OK for me, I mainly use templates as a convience (i.E. having the same code for e.g. 2D and 3D problems) and know which template parameters I will be using. However, Compaq cxx tries to be smart and treat filename.cc as part of the filename.h header file so that the class could be used even with template parameters that I have not forseen. However this breaks everything in my case because then those template functions will have an instance both in filename.o and in the object file of the compilation unit that included filename.h (e.g. test.o), and then the link step will fail. Now of course I could modify my makefiles to NOT link filename.o in case when Compaq cxx is used, but then a) I would further have to tear filename.cc apart (it also contains non-templated functions), and b) I think that this behaviour of Compaq cxx might be friendly for beginner programmers, but really it is bullshit because I absolutely DON'T want the compiler to #include files that I did not tell it to include. The problem can even be verified when just running cxx -E, there you will see that the preprocessor (or whatever, maybe a preprocessing template instantiator) has placed the contents of filename.cc into the compilation unit in addition to filename.h. If it is of interest I could boil this down to a small testcase and send it to an interested cxx developer. Viele Gr��e, Tobias