What is one definition rule in C ++?

What exactly does the definition rule do in C ++? The only reliable place I can find is the C ++ programming language, 3rd. ed., P. 9.2.3. Is there an official definition of the rule other than this?

+34
c ++ definition
Nov 16 '10 at 8:09
source share
1 answer

Truth in the standard (3.2 One definition rule):

No translation unit should contain more than one definition of any variable, function, class type, enumeration type or template.

[...]

Each program must contain exactly one definition of each non-line function or object that is used in this program ; no diagnostics required. The definition can be displayed explicitly in the program, it can be found in the standard or user library, or (if necessary), it is implicit (see 12.1, 12.4 and 12.8). a built-in function must be defined in each translation unit in which it b.

+31
Nov 16 '10 at 8:11
source share



All Articles