On Tue, 18 Jun 2002 08:58:01 -0400, Pierre Phaneuf <[EMAIL PROTECTED]> wrote:
> I thought that the string classes were all defined in the header files
> and thus did not have any link requirements, but it seems that there are
> "other" issues involved.

The string lib is statically linked, I think.


> The way to use this feature of gcc is via an attribute, like this:
> 
> class __attribute__((com_interface)) nsISupports {
>     ...
> };
> 
> This attribute is automatically inherited, so you do not need to declare
> all classes with it. Apparently that gcc 3 and up has the COM layout by
> default though, but this will make sure.

Ah, but our Official Compiler is egcs-1.1.2. Which means that anything we 
do has to work on that, or we have to upgrade the compiler, which brings 
us back to where we started.

Very rough tests apparently show that -O2 on gcc-3.1 is better than 
egcs-1.1.2 -O (the current usage) by about 7%.

Besides, I don't see this in the docs at

http://gcc.gnu.org/onlinedocs/gcc-3.1/gcc/Type-Attributes.html#Type%20Attributes

(although see below)

> 
> Since this is in the source code itself, there is no problem using it,
> as other programs won't have to do anything at all.

... except be compiled with gcc, and possibly specific versions of gcc.

> http://gcc.gnu.org/ml/gcc-bugs/1999-08n/msg01215.html

This says that virtual dtors aren't supported in com_interface stuff, and 
a class is com_interface if any of its parents are. That implies that 
anything which inherits off nsISupports couldn't use a virtual destructor. 
Since mozilla uses virtual destructors in that case in several places like 
this, that implies that we couldn't use it.

> http://gcc.gnu.org/ml/gcc-bugs/2001-03/msg00824.html
> 

and this says that this undocumented attribute is uneeded and deprecated,
and will be removed. Not something we want to be relying on...

Note that one of the reasons I asked dougt to document this was because
egcs is already 4 years old, and one of the reasons that we don't upgrade
(new libstdc++ isn't on older systems) may soon start working in the
reverse direction - how long before the old egcs compat libs are no longer
installed by default on linux systems? Not to mention that large perf
improvement we get.

Bradley

Reply via email to