Vague Linkage - Red Hat ENTERPRISE LINUX 3 - USING GCC Using Instructions

Using the gnu compiler collection (gcc)
Hide thumbs Also See for ENTERPRISE LINUX 3 - USING GCC:
Table of Contents

Advertisement

Chapter 7. Extensions to the C++ Language
{
/* ... */
}
Within the body of
T::fn
Notice that the interpretation of a
or
const
volatile
tent with other compilers which implement restricted pointers.
As with all outermost parameter qualifiers,
This means you only need to specify
prototype as well.

7.4. Vague Linkage

There are several constructs in C++ which require space in the object file but are not clearly tied to a
single translation unit. We say that these constructs have "vague linkage". Typically such constructs
are emitted wherever they are needed, though sometimes we can be more clever.
Inline Functions
Inline functions are typically defined in a header file which can be included in many different
compilations. Hopefully they can usually be inlined, but sometimes an out-of-line copy is neces-
sary, if the address of the function is taken or if inlining fails. In general, we emit an out-of-line
copy in all translation units where one is needed. As an exception, we only emit inline virtual
functions with the vtable, since it will always require a copy.
Local static variables and string constants used in an inline function are also considered to have
vague linkage, since they must be shared between all inlined and out-of-line instances of the
function.
VTables
C++ virtual functions are implemented in most compilers using a lookup table, known as a
vtable. The vtable contains pointers to the virtual functions provided by a class, and each object
of the class contains a pointer to its vtable (or vtables, in some multiple-inheritance situations).
If the class declares any non-inline, non-pure virtual functions, the first one is chosen as the "key
method" for the class, and the vtable is only emitted in the translation unit where the key method
is defined.
Note: If the chosen key method is later defined as inline, the vtable will still be emitted in every
translation unit which defines it. Make sure that any inline virtuals are declared inline in the class
body, even if they are not defined there.
type_info objects
C++ requires information about types to be written out in order to implement
and exception handling. For polymorphic classes (classes with virtual functions), the
typeid
type_info object is written out along with the vtable so that
dynamic type of a class object at runtime. For all other types, we write out the type_info object
when it is used: when applying
type in a catch clause or exception specification.
Template Instantiations
Most everything in this section also applies to template instantiations, but there are other options
as well. Section 7.6 Where's the Template?.
,
will have the effective definition
this
__restrict__
qualifier, in that it is applied to the pointer rather than the object. This is consis-
__restrict__
typeid
member function qualifier is different to that of
is ignored in function definition matching.
__restrict__
in a function definition, rather than in a function
to an expression, throwing an object, or referring to a
T *__restrict__ const this
dynamic_cast
can determine the
dynamic_cast
213
.
,

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the ENTERPRISE LINUX 3 - USING GCC and is the answer not in the manual?

Questions and answers

This manual is also suitable for:

Enterprise linux 3

Table of Contents