tmp/tmppqeem8sb/{from.md → to.md}
RENAMED
|
@@ -1,9 +1,10 @@
|
|
| 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 |
|
| 6 |
``` cpp
|
| 7 |
int i;
|
| 8 |
int i;
|
| 9 |
```
|
|
@@ -21,44 +22,44 @@ static struct X a = { 1, &b };
|
|
| 21 |
```
|
| 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.
|
| 27 |
-
|
| 28 |
call to achieve the initialization. Seldom.
|
| 29 |
|
| 30 |
-
[[basic.scope]] **Change:** A `struct` is a scope in C++, not in C
|
| 31 |
**Rationale:** Class scope is crucial to C++, and a struct is a class.
|
| 32 |
**Effect on original feature:** Change to semantics of well-defined
|
| 33 |
feature. Semantic transformation. C programs use `struct` extremely
|
| 34 |
frequently, but the change is only noticeable when `struct`,
|
| 35 |
enumeration, or enumerator names are referred to outside the `struct`.
|
| 36 |
The latter is probably rare.
|
| 37 |
|
| 38 |
[[basic.link]] \[also [[dcl.type]]\] **Change:** A name of file scope
|
| 39 |
that is explicitly declared `const`, and not explicitly declared
|
| 40 |
`extern`, has internal linkage, while in C it would have external
|
| 41 |
-
linkage **Rationale:** Because `const` objects
|
| 42 |
-
|
| 43 |
-
explicit initializer
|
| 44 |
-
user to put `const`objects in
|
| 45 |
-
|
| 46 |
-
of well-defined feature. Semantic transformation Seldom
|
| 47 |
|
| 48 |
-
[[basic.start]] **Change:**
|
| 49 |
-
have its address taken **Rationale:** The main
|
| 50 |
-
special actions. **Effect on original feature:**
|
| 51 |
-
semantically well-defined feature Trivial: create an
|
| 52 |
-
function such as `mymain(argc, argv)`. Seldom
|
| 53 |
|
| 54 |
[[basic.types]] **Change:** C allows “compatible types” in several
|
| 55 |
-
places, C++does not
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
C++. **Effect on
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
not
|
| 62 |
-
|
| 63 |
-
Standard. Common.
|
| 64 |
|
|
|
|
| 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 |
```
|
|
|
|
| 22 |
```
|
| 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 |
|