Difference between revisions of "cpp/language/basic concepts"
(added updated definition of "variable") |
(refined pre-c++14 definition of "variable") |
||
Line 19: | Line 19: | ||
{{rrev multi|until1=c++14 | {{rrev multi|until1=c++14 | ||
− | |rev1=Named objects and named references | + | |rev1=Named objects, and named references that are not {{rlp|data members|non-static data members}}, are ''variables''. |
− | |rev2=Declared objects, and declared references that are not | + | |rev2=Declared objects, and declared references that are not non-static data members, are ''variables'', whether named or unnamed. |
}} | }} | ||
Revision as of 12:21, 29 June 2018
This section provides definitions for the specific terminology and the concepts used when describing the C++ programming language.
A C++ program is a sequence of text files (typically header and source files) that contain declarations. They undergo translation to become an executable program, which is executed when the OS calls its main function.
Certain words in a C++ program have special meaning, and these are known as keywords. Others can be used as identifiers. Comments are ignored during translation. Certain characters in the program have to be represented with escape sequences.
The entities of a C++ program are values, objects, references, structured bindings(since C++17), functions, enumerators, types, class members, templates, template specializations, namespaces, and parameter packs. Preprocessor macros are not C++ entities.
Entities are introduced by declarations, which associate them with names and define their properties. The declarations that define all properties required to use an entity are definitions. A program must contain only one definition of any non-inline function or variable that is odr-used.
Definitions of functions include sequences of statements, some of which include expressions, which specify the computations to be performed by the program.
Names encountered in a program are associated with the declarations that introduced them using name lookup. Each name is only valid within a part of the program called its scope. Some names have linkage which makes them refer to the same entities when they appear in different scopes or translation units.
Each object, reference, function, expression in C++ is associated with a type, which may be fundamental, compound, or user-defined, complete or incomplete, etc.
Named objects, and named references that are not non-static data members, are variables. |
(until C++14) |
Declared objects, and declared references that are not non-static data members, are variables, whether named or unnamed. |
(since C++14) |
See also
C documentation for Basic concepts
|