From Jason Turner

[diff.basic]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpr_0a4s4_/{from.md → to.md} +29 -31
tmp/tmpr_0a4s4_/{from.md → to.md} RENAMED
@@ -1,19 +1,18 @@
1
- ### Clause [[basic]]: basic concepts <a id="diff.basic">[[diff.basic]]</a>
2
 
3
- [[basic.def]] **Change:** C++does not have “tentative definitions” as in
4
- C.
5
  E.g., at file scope,
6
 
7
  ``` cpp
8
  int i;
9
  int i;
10
  ```
11
 
12
  is valid in C, invalid in C++. This makes it impossible to define
13
- mutually referential file-local static objects, if initializers are
14
- restricted to the syntactic forms of C. For example,
15
 
16
  ``` cpp
17
  struct X { int i; struct X* next; };
18
 
19
  static struct X a;
@@ -23,43 +22,42 @@ static struct X a = { 1, &b };
23
 
24
  **Rationale:** This avoids having different initialization rules for
25
  fundamental types and user-defined types. **Effect on original
26
  feature:** Deletion of semantically well-defined feature. Semantic
27
  transformation. In C++, the initializer for one of a set of
28
- mutually-referential file-local static objects must invoke a function
29
- call to achieve the initialization. Seldom.
30
 
31
- [[basic.scope]] **Change:** A `struct` is a scope in C++, not in C.
32
- **Rationale:** Class scope is crucial to C++, and a struct is a class.
33
- **Effect on original feature:** Change to semantics of well-defined
34
- feature. Semantic transformation. C programs use `struct` extremely
35
- frequently, but the change is only noticeable when `struct`,
36
- enumeration, or enumerator names are referred to outside the `struct`.
37
- The latter is probably rare.
38
 
39
- [[basic.link]] \[also [[dcl.type]]\] **Change:** A name of file scope
40
- that is explicitly declared `const`, and not explicitly declared
41
- `extern`, has internal linkage, while in C it would have external
42
- linkage. **Rationale:** Because `const` objects may be used as values
43
- during translation in C++, this feature urges programmers to provide an
44
- explicit initializer for each `const` object. This feature allows the
45
- user to put `const` objects in source files that are included in more
46
- than one translation unit. **Effect on original feature:** Change to
47
- semantics of well-defined feature. Semantic transformation. Seldom.
48
 
49
- [[basic.start.main]] **Change:** The `main` function cannot be called
50
- recursively and cannot have its address taken. **Rationale:** The `main`
51
- function may require special actions. **Effect on original feature:**
52
- Deletion of semantically well-defined feature. Trivial: create an
53
- intermediary function such as `mymain(argc, argv)`. Seldom.
54
 
55
- [[basic.types]] **Change:** C allows “compatible types” in several
56
- places, C++does not.
57
  For example, otherwise-identical `struct` types with different tag names
58
  are “compatible” in C but are distinctly different types in C++.
59
  **Rationale:** Stricter type checking is essential for C++. **Effect on
60
  original feature:** Deletion of semantically well-defined feature.
61
  Semantic transformation. The “typesafe linkage” mechanism will find
62
  many, but not all, of such problems. Those problems not found by
63
  typesafe linkage will continue to function properly, according to the
64
- “layout compatibility rules” of this International Standard. Common.
65
 
 
1
+ ### [[basic]]: basics <a id="diff.basic">[[diff.basic]]</a>
2
 
3
+ **Change:** C++ does not have “tentative definitions” as in C.
 
4
  E.g., at file scope,
5
 
6
  ``` cpp
7
  int i;
8
  int i;
9
  ```
10
 
11
  is valid in C, invalid in C++. This makes it impossible to define
12
+ mutually referential file-local objects with static storage duration, if
13
+ initializers are restricted to the syntactic forms of C. For example,
14
 
15
  ``` cpp
16
  struct X { int i; struct X* next; };
17
 
18
  static struct X a;
 
22
 
23
  **Rationale:** This avoids having different initialization rules for
24
  fundamental types and user-defined types. **Effect on original
25
  feature:** Deletion of semantically well-defined feature. Semantic
26
  transformation. In C++, the initializer for one of a set of
27
+ mutually-referential file-local objects with static storage duration
28
+ must invoke a function call to achieve the initialization. Seldom.
29
 
30
+ **Change:** A `struct` is a scope in C++, not in C. **Rationale:** Class
31
+ scope is crucial to C++, and a struct is a class. **Effect on original
32
+ feature:** Change to semantics of well-defined feature. Semantic
33
+ transformation. C programs use `struct` extremely frequently, but the
34
+ change is only noticeable when `struct`, enumeration, or enumerator
35
+ names are referred to outside the `struct`. The latter is probably rare.
 
36
 
37
+ \[also [[dcl.type]]\] **Change:** A name of file scope that is
38
+ explicitly declared `const`, and not explicitly declared `extern`, has
39
+ internal linkage, while in C it would have external linkage.
40
+ **Rationale:** Because const objects may be used as values during
41
+ translation in C++, this feature urges programmers to provide an
42
+ explicit initializer for each const object. This feature allows the user
43
+ to put const objects in source files that are included in more than one
44
+ translation unit. **Effect on original feature:** Change to semantics of
45
+ well-defined feature. Semantic transformation. Seldom.
46
 
47
+ **Change:** The `main` function cannot be called recursively and cannot
48
+ have its address taken. **Rationale:** The `main` function may require
49
+ special actions. **Effect on original feature:** Deletion of
50
+ semantically well-defined feature. Trivial: create an intermediary
51
+ function such as `mymain(argc, argv)`. Seldom.
52
 
53
+ **Change:** C allows “compatible types” in several places, C++ does
54
+ not.
55
  For example, otherwise-identical `struct` types with different tag names
56
  are “compatible” in C but are distinctly different types in C++.
57
  **Rationale:** Stricter type checking is essential for C++. **Effect on
58
  original feature:** Deletion of semantically well-defined feature.
59
  Semantic transformation. The “typesafe linkage” mechanism will find
60
  many, but not all, of such problems. Those problems not found by
61
  typesafe linkage will continue to function properly, according to the
62
+ “layout compatibility rules” of this document. Common.
63