You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This section provides definitions for the specific terminology and the concepts used when describing the C programming language.
14
+
15
+
A C program is a sequence of text files (typically header and source files) that coimport DocLink from "@components/DocLink.astro";
16
+
17
+
# Basic concepts
18
+
19
+
This section provides definitions for the specific terminology and the concepts used when describing the C programming language.
20
+
21
+
A C program is a sequence of text files (typically header and source files) that contain <DocLinksrc="/c/language/declarations">declarations</DocLink>. They undergo <DocLinksrc="/c/language/translation_phases">translation</DocLink> to become an executable program, which is executed when the OS calls its <DocLinksrc="/c/language/main_function">main function</DocLink> (unless it is itself the OS or another *freestanding* program, in which case the entry point is implementation-defined).
22
+
23
+
Certain words in a C program have special meaning, they are <DocLinksrc="/c/keyword">keywords</DocLink>. Others can be used as <DocLinksrc="/c/language/identifier">identifiers</DocLink>, which may be used to identify <DocLinksrc="/c/language/object">objects</DocLink>, <DocLinksrc="/c/language/functions">functions</DocLink>, <DocLinksrc="/c/language/struct">struct</DocLink>, <DocLinksrc="/c/language/union">union</DocLink>, or <DocLinksrc="/c/language/enum">enumeration</DocLink> tags, their members, <DocLinksrc="/c/language/typedef">typedef</DocLink> names, <DocLinksrc="/c/language/statements">labels</DocLink>, or <DocLinksrc="/c/preprocessor/replace">macros</DocLink>.
24
+
25
+
Each identifier (other than macro) is only valid within a part of the program called its <DocLinksrc="/c/language/scope">scope</DocLink> and belongs to one of four kinds of <DocLinksrc="/c/language/name_space">name spaces</DocLink>. Some identifiers have <DocLinksrc="/c/language/storage_duration">linkage</DocLink> which makes them refer to the same entities when they appear in different scopes or translation units.
26
+
27
+
Definitions of functions include sequences of <DocLinksrc="/c/language/statements">statements</DocLink> and <DocLinksrc="/c/language/declarations">declarations</DocLink>, some of which include <DocLinksrc="/c/language/expressions">expressions</DocLink>, which specify the computations to be performed by the program.
28
+
29
+
<DocLinksrc="/c/language/declarations">Declarations</DocLink> and <DocLinksrc="/c/language/expressions">expressions</DocLink> create, destroy, access, and manipulate <DocLinksrc="/c/language/object">objects</DocLink>. Each <DocLinksrc="/c/language/object">object</DocLink>, <DocLinksrc="/c/language/functions">function</DocLink>, and <DocLinksrc="/c/language/expressions">expression</DocLink> in C is associated with a <DocLinksrc="/c/language/type">type</DocLink>.
Copy file name to clipboardExpand all lines: src/content/docs/cpp/language/basics.mdx
+15-10Lines changed: 15 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,24 +6,29 @@ cppdoc:
6
6
keys: ["cpp.lang.basic"]
7
7
---
8
8
9
-
importMissingfrom"@components/Missing.astro";
10
-
importDocLinkfrom"@components/DocLink.astro";
11
9
import { Revision } from"@components/revision";
10
+
importDocLinkfrom"@components/DocLink.astro";
11
+
12
+
# Basic concepts
12
13
13
14
This section provides definitions for the specific terminology and the concepts used when describing the C++ programming language.
14
15
15
-
A C++ program is a sequence of text files (typically header and source files) that contain <Missing>declarations</Missing>. They undergo <Missing>translation</Missing> to become an executable program, which is executed when the C++ implementation calls its <DocLinksrc="/cpp/language/main_function">main function</DocLink>.
16
+
A C++ program is a sequence of text files (typically header and source files) that contain <DocLinksrc="/cpp/language/declarations">declarations</DocLink>. They undergo <DocLinksrc="/cpp/language/translation_phases">translation</DocLink> to become an executable program, which is executed when the C++ implementation calls its <DocLinksrc="/cpp/language/main_function">main function</DocLink>.
17
+
18
+
Certain words in a C++ program have special meaning, and these are known as <DocLinksrc="/cpp/keyword">keywords</DocLink>. Others can be used as <DocLinksrc="/cpp/language/identifiers">identifiers</DocLink>. <DocLinksrc="/cpp/comment">Comments</DocLink> are ignored during translation. C++ programs also contain <DocLinksrc="/cpp/language/expressions">literals</DocLink>, the values of characters inside them are determined by <DocLinksrc="/cpp/language/charset">character sets and encodings</DocLink>. Certain characters in the program have to be represented with <DocLinksrc="/cpp/language/escape">escape sequences</DocLink>.
19
+
20
+
The *entities* of a C++ program are values, <DocLinksrc="/cpp/language/objects">objects</DocLink>, <DocLinksrc="/cpp/language/reference">references</DocLink><Revisionsince="C++17">, <DocLinksrc="/cpp/language/structured_binding">structured bindings</DocLink></Revision><Revisionsince="C++26">, <DocLinksrc="/cpp/language/function">result bindings</DocLink></Revision>, <DocLinksrc="/cpp/language/functions">functions</DocLink>, <DocLinksrc="/cpp/language/enum">enumerators</DocLink>, <DocLinksrc="/cpp/language/type">types</DocLink>, class members, <DocLinksrc="/cpp/language/templates">templates</DocLink>, <DocLinksrc="/cpp/language/template_specialization">template specializations</DocLink><Revisionsince="C++11">, <DocLinksrc="/cpp/language/pack">packs</DocLink></Revision>, and <DocLinksrc="/cpp/language/namespace">namespaces</DocLink>. Preprocessor <DocLinksrc="/cpp/preprocessor/replace">macros</DocLink> are not C++ entities.
16
21
17
-
Certain words in a C++ program have special meaning, and these are known as <Missing>keywords</Missing>. Others can be used as <Missing>identifiers</Missing>. <Missing>Comments</Missing> are ignored during translation. C++ programs also contain <Missing>literals</Missing>, the values of characters inside them are determined by <Missing>character sets and encodings</Missing>. Certain characters in the program have to be represented with <Missing>escape sequences</Missing>.
22
+
<DocLinksrc="/cpp/language/declarations">Declarations</DocLink> may introduce entities, associate them with <DocLinksrc="/cpp/language/name">names</DocLink> and define their properties. The declarations that define all properties required to use an entity are <DocLinksrc="/cpp/language/definition">definitions</DocLink>. A program must contain only one definition of any non-inline function or variable that is <DocLinksrc="/cpp/language/definition">odr-used</DocLink>.
18
23
19
-
The _entities_of a C++ program are values, <Missing>objects</Missing>, <Missing>references</Missing><Revisionsince="C++17">, <Missing>structured bindings</Missing></Revision><Revisionsince="C++26">, <Missing>result bindings</Missing></Revision>, <Missing>functions</Missing>, <Missing>enumerators</Missing>, <Missing>types</Missing>, class members, <Missing>templates</Missing>, <Missing>template specializations</Missing><Revisionsince="C++11">, <Missing>packs</Missing></Revision>, and <Missing>namespaces</Missing>. Preprocessor <Missing>macros</Missing> are not C++ entities.
24
+
Definitions of functions usually include sequences of <DocLinksrc="/cpp/language/statements">statements</DocLink>, some of which include <DocLinksrc="/cpp/language/expressions">expressions</DocLink>, which specify the computations to be performed by the program.
20
25
21
-
<Missing>Declarations</Missing> may introduce entities, associate them with <Missing>names</Missing> and define their properties. The declarations that define all properties required to use an entity are <Missing>definitions</Missing>. A program must contain only one definition of any non-inline function or variable that is <Missing>odr-used</Missing>.
26
+
Names encountered in a program are associated with the declarations that introduced them using <DocLinksrc="/cpp/language/lookup">name lookup</DocLink>. Each name is only valid within a part of the program called its <DocLinksrc="/cpp/language/scope">scope</DocLink>. Some names have <DocLinksrc="/cpp/language/storage_duration">linkage</DocLink> which makes them refer to the same entities when they appear in different scopes or translation units.
22
27
23
-
Definitions of functions usually include sequences of <Missing>statements</Missing>, some of which include <Missing>expressions</Missing>, which specify the computations to be performed by the program.
28
+
Each object, reference, function, expression in C++ is associated with a <DocLinksrc="/cpp/language/type">type</DocLink>, which may be <DocLinksrc="/cpp/language/types">fundamental</DocLink>, compound, or <DocLinksrc="/cpp/language/classes">user-defined</DocLink>, complete or <DocLinksrc="/cpp/language/incomplete_type">incomplete</DocLink>, etc.
24
29
25
-
Names encountered in a program are associated with the declarations that introduced them using <Missing>name lookup</Missing>. Each name is only valid within a part of the program called its <Missing>scope</Missing>. Some names have <Missing>linkage</Missing> which makes them refer to the same entities when they appear in different scopes or translation units.
30
+
Declared objects and declared references that are not <DocLinksrc="/cpp/language/data_members">non-static data members</DocLink> are *variables *.
26
31
27
-
Each object, reference, function, expression in C++ is associated with a <Missing>type</Missing>, which may be <Missing>fundamental</Missing>, compound, or <Missing>user-defined</Missing>, complete or <Missing>incomplete</Missing>, etc.
32
+
## See also
28
33
29
-
Declared objects and declared references that are not <Missing>non-static data members</Missing> are _variables_.
34
+
C documentation for <DocLinksrc="/c/language/basic_concepts">Basic concepts</DocLink>
0 commit comments