RAD Studio
ContentsIndex
PreviousUpNext
External Declarations and Definitions

The storage class specifiers auto and register cannot appear in an external declaration. For each identifier in a translation unit declared with internal linkage, no more than one external definition can be given. 

An external definition is an external declaration that also defines an object or function; that is, it also allocates storage. If an identifier declared with external linkage is used in an expression (other than as part of the operand of sizeof), then exactly one external definition of that identifier must exist in the entire program. 

The C++ compiler allows later declarations of external names, such as arrays, structures, and unions, to add information to earlier declarations. Here's an example:

int a[];              // no size
struct mystruct;      // tag only, no member declarators
  .
  .
  .
int a[3] = {1, 2, 3}; // supply size and initialize
struct mystruct {
   int i, j;
};                    // add member declarators

CodeGear C++ class declaration syntax (C++ only) covers class declaration syntax. In the section on classes (beginning with Classes), you can find examples of how to declare a class. Referencing covers C++ reference types (closely related to pointer types) in detail. Finally, see Using Templates for a discussion of template-type classes. 

CodeGear C++ class declaration syntax (C++ only) 

class-specifier: base-specifier: 

class-head { <member-list> } : base-list 

class-head: base-list: 

class-key <identifier> <base-specifier> base-specifier 

class-key class-name <base-specifier> base-list , base-specifier 

member-list: base-specifier: 

member-declaration <member-list> class-name 

access-specifier : <member-list> virtual <access-specifier> class-name 

member-declaration: access-specifier <virtual> class-name 

<decl-specifiers> <member-declarator-list> ; access-specifier: 

function-definition <;> private 

qualified-name ; protected 

member-declarator-list: public 

member-declarator conversion-function-name: 

member-declarator-list, member-declarator operator conversion-type-name 

member-declarator: conversion-type-name: 

declarator <pure-specifier> type-specifiers <pointer-operator> 

<identifier> : constant-expression constructor-initializer: 

pure-specifier: : member-initializer-list 

= 0  

member-initializer-list: operator-name: one of 

member-initializer new delete sizeof typeid 

member-initializer , member-initializer-list + - * / % ^ 

member-initializer: & | ~ ! = <> 

class name ( <argument-list> ) += -= =* /= %= ^= 

identifier ( <argument-list> ) &= |= << >> >>= <<= 

operator-function-name: == != <= >= && || 

operator operator-name ++ __ , ->* -> () 

[ ] .* 

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!