Usenet comp.unix.tru64 (2000-2013)
 help / color / mirror / Atom feed
* cxx annoyance
@ 2001-06-18 19:40 Tobias Ernst
  2001-06-19  2:30 ` Mark Garrett
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Tobias Ernst @ 2001-06-18 19:40 UTC (permalink / raw)


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



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: cxx annoyance
  2001-06-18 19:40 cxx annoyance Tobias Ernst
@ 2001-06-19  2:30 ` Mark Garrett
  2001-06-19  8:50   ` Tobias Ernst
  2001-06-19  6:02 ` Pentyern
  2001-06-19  7:24 ` Wolfram Klaus
  2 siblings, 1 reply; 10+ messages in thread
From: Mark Garrett @ 2001-06-19  2:30 UTC (permalink / raw)


in article 992888612@f1.n7600.z242.fido.de, Tobias Ernst at
tobi@bland.fido.de wrote on 19/06/2001 06:40:

> 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.

Interesting.
mark@ned> cxx -V
Compaq C++ V6.3-005 for Compaq Tru64 UNIX V5.1 (Rev. 732)
Compiler Driver V6.3-005 (cxx) cxx Driver
mark@ned>
mark@ned> cxx -c main.cc
mark@ned> cat main.cc
#include "t.h"

main()
{
        int ii;

        ii = 3;
}
mark@ned> cat t.h
struct c {
        int i;
} C;


mark@ned> cat t.cc
#error "this file should not be included"
mark@ned>

It doesn't look like V6.3-005 has this problem. Guess I'll have to upgrade.
I can't wait to be caught with this little trick :)

    Cheers
        Mark ;)



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: cxx annoyance
  2001-06-18 19:40 cxx annoyance Tobias Ernst
  2001-06-19  2:30 ` Mark Garrett
@ 2001-06-19  6:02 ` Pentyern
  2001-06-19  8:51   ` Tobias Ernst
  2001-06-19  7:24 ` Wolfram Klaus
  2 siblings, 1 reply; 10+ messages in thread
From: Pentyern @ 2001-06-19  6:02 UTC (permalink / raw)


Hi,
is it possible to get the compaq cxx for Tru64 for free, like the cxx for 
alphalinux?
Regards Carsten



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: cxx annoyance
  2001-06-18 19:40 cxx annoyance Tobias Ernst
  2001-06-19  2:30 ` Mark Garrett
  2001-06-19  6:02 ` Pentyern
@ 2001-06-19  7:24 ` Wolfram Klaus
  2001-06-19  8:54   ` Tobias Ernst
  2001-06-27 10:53   ` Tobias Ernst
  2 siblings, 2 replies; 10+ messages in thread
From: Wolfram Klaus @ 2001-06-19  7:24 UTC (permalink / raw)


tobi@bland.fido.de (Tobias Ernst) writes:
t
>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?

Sure, there is and it's in the man page...

  -[no]implicit_include
       Effective only with Version 6.0 and later. Enable or disable inclusion
       of source files as a method of finding definitions of template enti-
       ties.  Implicit inclusion is enabled by default, and it is disabled
       when compiling with -E or -P. The search rules for finding template
       definition files are the same as for include files.  This option also
       defines the macro __IMPLICIT_INCLUDE_ENABLED. You might want to dis-
       able implicit inclusion with the -ms and -std ms options to match the
       behavior on Microsoft C++ more closely.



[...]

>Viele Gr��e,
>Tobias
 Ebenso,
 Wolfram
--
Wolfram Klaus  (Wolfram.Klaus@physik.fu-berlin.de)        
Free University Berlin
Physics Department  
                                   


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: cxx annoyance
  2001-06-19  2:30 ` Mark Garrett
@ 2001-06-19  8:50   ` Tobias Ernst
  0 siblings, 0 replies; 10+ messages in thread
From: Tobias Ernst @ 2001-06-19  8:50 UTC (permalink / raw)


Hallo Mark!

 mark@ned>> cat t.h
 MG> struct c {
 MG>         int i;
 MG> } C;


 mark@ned>> cat t.cc
 MG> #error "this file should not be included"
 mark@ned>>

That's too easy. You must use template code in both the t.h and the 
t.cc file, something like

template <class T> void foo(T& arg);

in the header file and

then the implementation of foo and instantiations of it in the cc file.

Viele Gr��e,
Tobias



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: cxx annoyance
  2001-06-19  6:02 ` Pentyern
@ 2001-06-19  8:51   ` Tobias Ernst
  2001-06-19 15:56     ` Pentyern
  2001-06-19 19:29     ` Tim Mooney
  0 siblings, 2 replies; 10+ messages in thread
From: Tobias Ernst @ 2001-06-19  8:51 UTC (permalink / raw)


Hallo Pentyern!

 P> is it possible to get the compaq cxx for Tru64 for free, 
 P> like the cxx for alphalinux?

No idea, as we have a complete campus license for Tru64 plus the 
Developer's Tool box and everything else.

You can for sure download Compaq cxx for free. Visit compaq.com, go to 
Products, Development, ... and sooner or later you are at a place where 
you can download a setld package. The question is if it will run when 
you don't have a proper license registered in lmf, or if this would be 
legal.

I always wondered if cxx was part of the Hobbyist pack of Tru64, but I 
guess your question tells me that the answer is no? :-)

Viele Gr��e,
Tobias



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: cxx annoyance
  2001-06-19  7:24 ` Wolfram Klaus
@ 2001-06-19  8:54   ` Tobias Ernst
  2001-06-27 10:53   ` Tobias Ernst
  1 sibling, 0 replies; 10+ messages in thread
From: Tobias Ernst @ 2001-06-19  8:54 UTC (permalink / raw)


Hallo Wolfram!

 WK> Sure, there is and it's in the man page...

 WK>   -[no]implicit_include

Oh. Guess how many times I read the manpage, and I overlook this one 
every time. Shame on me. :-)

 WK>        Effective only with Version 6.0 and later. Enable or 
 WK> disable inclusion of source files as a method of finding 
 WK> definitions 
 WK> of template entities.  Implicit inclusion is enabled by default, 
 WK> and 
 WK> it is disabled  when compiling with -E or -P. The search rules for 
 WK> 

This at least is not true vor my version of cxx. I also saw the effect 
when compiling with -E, or else it probably would have taken me much 
longer to diagnose where all those duplicate symbols came from.

Thank you very much for the hint, I'll try it out this afternoon.

Viele Gr��e,
Tobias



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: cxx annoyance
  2001-06-19  8:51   ` Tobias Ernst
@ 2001-06-19 15:56     ` Pentyern
  2001-06-19 19:29     ` Tim Mooney
  1 sibling, 0 replies; 10+ messages in thread
From: Pentyern @ 2001-06-19 15:56 UTC (permalink / raw)


Tobias Ernst wrote:

> Hallo Pentyern!
> 
>  P> is it possible to get the compaq cxx for Tru64 for free,
>  P> like the cxx for alphalinux?
> 
> No idea, as we have a complete campus license for Tru64 plus the
> Developer's Tool box and everything else.
> 
> You can for sure download Compaq cxx for free. Visit compaq.com, go to
> Products, Development, ... and sooner or later you are at a place where
> you can download a setld package. The question is if it will run when
> you don't have a proper license registered in lmf, or if this would be
> legal.
> 
> I always wondered if cxx was part of the Hobbyist pack of Tru64, but I
> guess your question tells me that the answer is no? :-)
> 
> Viele Gr��e,
> Tobias

or I'm too stupid to find it :-)
can you get a campus licence as student, too?
Gr�sse zur�

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: cxx annoyance
  2001-06-19  8:51   ` Tobias Ernst
  2001-06-19 15:56     ` Pentyern
@ 2001-06-19 19:29     ` Tim Mooney
  1 sibling, 0 replies; 10+ messages in thread
From: Tim Mooney @ 2001-06-19 19:29 UTC (permalink / raw)


In article <992944045@f1.n7600.z242.fido.de>,
Tobias Ernst <tobi@bland.fido.de> wrote:
> Hallo Pentyern!
> 
> I always wondered if cxx was part of the Hobbyist pack of Tru64, but I 
> guess your question tells me that the answer is no? :-)

It was not part of the original hobbyist pack (for 5.0).  I haven't purchased
the 5.1 pack yet (I may just wait until 5.1A).  All the other development
bits were included, although I think the MME-DEV bits (the license to
load the headers, so you can compile programs using the MMS/MME API) were
also left out, though I think MME has been changed so it's all part of one
package these days, so no separate license is needed.  I could of course
be wrong about this.  ;-)

Tim
-- 
Tim Mooney                              mooney@dogbert.cc.ndsu.NoDak.edu
Information Technology Services         (701) 231-1076 (Voice)
Room 242-J6, IACC Building              (701) 231-8541 (Fax)
North Dakota State University, Fargo, ND 58105-5164


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: cxx annoyance
  2001-06-19  7:24 ` Wolfram Klaus
  2001-06-19  8:54   ` Tobias Ernst
@ 2001-06-27 10:53   ` Tobias Ernst
  1 sibling, 0 replies; 10+ messages in thread
From: Tobias Ernst @ 2001-06-27 10:53 UTC (permalink / raw)


Hallo!

 WK>>   -[no]implicit_include

Just wanted to drop a note to the newsgroup to confirm that this has 
solved my problem.

Viele Gr��e,
Tobias



^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2001-06-27 10:53 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-06-18 19:40 cxx annoyance Tobias Ernst
2001-06-19  2:30 ` Mark Garrett
2001-06-19  8:50   ` Tobias Ernst
2001-06-19  6:02 ` Pentyern
2001-06-19  8:51   ` Tobias Ernst
2001-06-19 15:56     ` Pentyern
2001-06-19 19:29     ` Tim Mooney
2001-06-19  7:24 ` Wolfram Klaus
2001-06-19  8:54   ` Tobias Ernst
2001-06-27 10:53   ` Tobias Ernst

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox