Nits

Jim Dehnert dehnert at baalbek.engr.sgi.com
Thu Aug 10 18:40:05 UTC 2000


> From mitchell at codesourcery.com Thu Aug 10 11:21:42 2000
> 
> >>>>> "Jim" == Jim Dehnert <dehnert at baalbek.engr.sgi.com> writes:
> 
>     Jim> Is the new wording in 5.2.2 and 5.2 respectively OK?
> 
> Almost.  I think that in:
> 
>   Note that nothing in this section should be construed to require
>   COMDAT usage for objects with internal linkage unless they may in fact
>   be referenced outside the translation unit where they appear, for
>   instance due to inlining.
> 
> the "unless" clause is unnecessary and misleading.  (In other words,
> the condition can never be true.)
> 
> If a function has internal linkage it cannot be referenced outside the
> translation unit.
> 
>   static inline void f() { static int x; }
> 
> should result in a different `x' everywhere this function is used.

In principle, but not exactly in practice.  The source code semantics
don't necessarily match the object code structure.  Suppose that you
also have:

	[inline] void g() { f(); }

You inline the call to f() into the body of g(), and then, whether
because it's declared inline or because you have an intelligent
compiler with inter-file inlining capabilities, you inline calls to g()
in some number of other files.  Now you have references to the same
static int x in multiple files.  That requires COMDAT, unless we
require that it be emitted in the file where originally defined even if
no references to it remain there (with externs elsewhere).

Jim

-	    Jim Dehnert		dehnert at sgi.com
				(650)933-4272




More information about the cxx-abi-dev mailing list