De betekenis van declaratie/definitie zou moeten kloppen in ieder geval.
Maar hetvolgende compileert in ieder geval niet hier:
int a = 5;
int a;
Dan zegt de compiler "redeclaration of.."
En wat zegt wikipedia:
The One Definition Rule (ODR) is an important concept in the C++ programming language.
In short the ODR states that:
1. In any translation unit, a template, type, function, or object can have no more than one definition. Some of these can have any number of declarations. A definition provides an instance.
2. In the entire program, an object or non-inline function cannot have more than one definition; if an object or function is used, it must have exactly one definition. You can declare an object or function that is never used, in which case you don't have to provide a definition. In no event can there be more than one definition.
3. Some things, like types, templates, and extern inline functions, can be defined in more than one translation unit. For a given entity, each definition must be the same. Non-extern objects and functions in different translation units are different entities, even if their names and types are the same.
Maw die one definition rule slaat eigenlijk niet terug op variabelen denk ik..
[i]"Everything should be made as simple as possible, but not simpler."[/i] - Albert Einstein