[comp.lang.c++] +e option in cfront 1.2

deb@svax.cs.cornell.edu (David Baraff) (10/12/88)

Could someone please e-mail me the correct way to use the
+e option in cfront 1.2? I had such a description of how/when/why
to use this in regard to virtual functions, but I threw it out.
(It came with the update notes for cfront 1.2 actually).

On a related subject, suppose I have a header file containing

class B : A {
	void	foo() { printf("This is an inline function for B\n");
};

where 'foo' is virtual. Does this mean that every file containing this
header will then contain a non-inline static copy of the function 'foo'?
I.e. I assume that all virtual functions must be non-inline, so that
the address of the function can be taken for the vtbl table.

If the above is true, there should be some sort of warning that
this is going to happen -- I must have libraries that have 27 static
copies of functions, because each of the 27 .C files making up
the library included the same header file. This must eat up space!
Is there ever any point in writing virtual functions as inline?


	David Baraff
	deb@svax.cs.cornell.edu
		or
	allegra!deb

diamond@csl.sony.JUNET (Norman Diamond) (10/14/88)

In article <21678@cornell.UUCP>, deb@svax.cs.cornell.edu (David Baraff) writes:

> Could someone please e-mail me the correct way to use the
> +e option in cfront 1.2?

Sorry, not this one.

> I must have libraries that have 27 static
> copies of functions, because each of the 27 .C files making up
> the library included the same header file.  This must eat up space!

It should only be 27 copies of very small functions.  If they're not
so small, you wouldn't bother inlining them.  However, it might work
to split up your header, only including the definition in modules
that use the function.  (I'm not sure -- please inform me if you
find out.)

> Is there ever any point in writing virtual functions as inline?

This one is obvious -- execution time can still be saved if you have
a smart linker.
-- 
-------------------------------------------------------------------------------
  The above opinions are my own.   |   Norman Diamond
  If they're also your opinions,   |   Sony Computer Science Laboratory, Inc.
  you're infringing my copyright.  |   diamond%csl.sony.jp@relay.cs.net