tmp/tmpe11h8_x8/{from.md → to.md}
RENAMED
|
@@ -2,11 +2,12 @@
|
|
| 2 |
|
| 3 |
[[class.name]] \[see also [[dcl.typedef]]\] **Change:** In C++, a class
|
| 4 |
declaration introduces the class name into the scope where it is
|
| 5 |
declared and hides any object, function or other declaration of that
|
| 6 |
name in an enclosing scope. In C, an inner scope declaration of a struct
|
| 7 |
-
tag name never hides the name of an object or function in an outer
|
|
|
|
| 8 |
|
| 9 |
Example:
|
| 10 |
|
| 11 |
``` cpp
|
| 12 |
int x[99];
|
|
@@ -35,11 +36,11 @@ Seldom.
|
|
| 35 |
|
| 36 |
[[class.bit]] **Change:** Bit-fields of type plain `int` are signed.
|
| 37 |
**Rationale:** Leaving the choice of signedness to implementations could
|
| 38 |
lead to inconsistent definitions of template specializations. For
|
| 39 |
consistency, the implementation freedom was eliminated for non-dependent
|
| 40 |
-
types, too. **Effect on original feature:** The
|
| 41 |
implementation-defined in C, but not so in C++. Syntactic
|
| 42 |
transformation. Seldom.
|
| 43 |
|
| 44 |
[[class.nest]] **Change:** In C++, the name of a nested class is local
|
| 45 |
to its enclosing class. In C the name of the nested class belongs to the
|
|
@@ -47,11 +48,11 @@ same scope as the name of the outermost enclosing class.
|
|
| 47 |
|
| 48 |
Example:
|
| 49 |
|
| 50 |
``` cpp
|
| 51 |
struct X {
|
| 52 |
-
struct Y {
|
| 53 |
};
|
| 54 |
struct Y yy; // valid C, invalid C++
|
| 55 |
```
|
| 56 |
|
| 57 |
**Rationale:** C++classes have member functions which require that
|
|
@@ -59,30 +60,30 @@ classes establish scopes. The C rule would leave classes as an
|
|
| 59 |
incomplete scope mechanism which would prevent C++programmers from
|
| 60 |
maintaining locality within a class. A coherent set of scope rules for
|
| 61 |
C++based on the C rule would be very complicated and C++programmers
|
| 62 |
would be unable to predict reliably the meanings of nontrivial examples
|
| 63 |
involving nested or local functions. **Effect on original feature:**
|
| 64 |
-
Change
|
| 65 |
make the struct type name visible in the scope of the enclosing struct,
|
| 66 |
the struct tag could be declared in the scope of the enclosing struct,
|
| 67 |
before the enclosing struct is defined. Example:
|
| 68 |
|
| 69 |
``` cpp
|
| 70 |
struct Y; // struct Y and struct X are at the same scope
|
| 71 |
struct X {
|
| 72 |
-
struct Y {
|
| 73 |
};
|
| 74 |
```
|
| 75 |
|
| 76 |
All the definitions of C struct types enclosed in other struct
|
| 77 |
definitions and accessed outside the scope of the enclosing struct could
|
| 78 |
be exported to the scope of the enclosing struct. Note: this is a
|
| 79 |
consequence of the difference in scope rules, which is documented in
|
| 80 |
[[basic.scope]]. Seldom.
|
| 81 |
|
| 82 |
[[class.nested.type]] **Change:** In C++, a typedef name may not be
|
| 83 |
-
redeclared in a class definition after being used in that definition
|
| 84 |
|
| 85 |
Example:
|
| 86 |
|
| 87 |
``` cpp
|
| 88 |
typedef int I;
|
|
@@ -92,10 +93,10 @@ struct S {
|
|
| 92 |
};
|
| 93 |
```
|
| 94 |
|
| 95 |
**Rationale:** When classes become complicated, allowing such a
|
| 96 |
redefinition after the type has been used can create confusion for C++
|
| 97 |
-
programmers as to what the meaning of
|
| 98 |
original feature:** Deletion of semantically well-defined feature.
|
| 99 |
Semantic transformation. Either the type or the struct member has to be
|
| 100 |
renamed. Seldom.
|
| 101 |
|
|
|
|
| 2 |
|
| 3 |
[[class.name]] \[see also [[dcl.typedef]]\] **Change:** In C++, a class
|
| 4 |
declaration introduces the class name into the scope where it is
|
| 5 |
declared and hides any object, function or other declaration of that
|
| 6 |
name in an enclosing scope. In C, an inner scope declaration of a struct
|
| 7 |
+
tag name never hides the name of an object or function in an outer
|
| 8 |
+
scope.
|
| 9 |
|
| 10 |
Example:
|
| 11 |
|
| 12 |
``` cpp
|
| 13 |
int x[99];
|
|
|
|
| 36 |
|
| 37 |
[[class.bit]] **Change:** Bit-fields of type plain `int` are signed.
|
| 38 |
**Rationale:** Leaving the choice of signedness to implementations could
|
| 39 |
lead to inconsistent definitions of template specializations. For
|
| 40 |
consistency, the implementation freedom was eliminated for non-dependent
|
| 41 |
+
types, too. **Effect on original feature:** The choice is
|
| 42 |
implementation-defined in C, but not so in C++. Syntactic
|
| 43 |
transformation. Seldom.
|
| 44 |
|
| 45 |
[[class.nest]] **Change:** In C++, the name of a nested class is local
|
| 46 |
to its enclosing class. In C the name of the nested class belongs to the
|
|
|
|
| 48 |
|
| 49 |
Example:
|
| 50 |
|
| 51 |
``` cpp
|
| 52 |
struct X {
|
| 53 |
+
struct Y { ... } y;
|
| 54 |
};
|
| 55 |
struct Y yy; // valid C, invalid C++
|
| 56 |
```
|
| 57 |
|
| 58 |
**Rationale:** C++classes have member functions which require that
|
|
|
|
| 60 |
incomplete scope mechanism which would prevent C++programmers from
|
| 61 |
maintaining locality within a class. A coherent set of scope rules for
|
| 62 |
C++based on the C rule would be very complicated and C++programmers
|
| 63 |
would be unable to predict reliably the meanings of nontrivial examples
|
| 64 |
involving nested or local functions. **Effect on original feature:**
|
| 65 |
+
Change to semantics of well-defined feature. Semantic transformation. To
|
| 66 |
make the struct type name visible in the scope of the enclosing struct,
|
| 67 |
the struct tag could be declared in the scope of the enclosing struct,
|
| 68 |
before the enclosing struct is defined. Example:
|
| 69 |
|
| 70 |
``` cpp
|
| 71 |
struct Y; // struct Y and struct X are at the same scope
|
| 72 |
struct X {
|
| 73 |
+
struct Y { ... } y;
|
| 74 |
};
|
| 75 |
```
|
| 76 |
|
| 77 |
All the definitions of C struct types enclosed in other struct
|
| 78 |
definitions and accessed outside the scope of the enclosing struct could
|
| 79 |
be exported to the scope of the enclosing struct. Note: this is a
|
| 80 |
consequence of the difference in scope rules, which is documented in
|
| 81 |
[[basic.scope]]. Seldom.
|
| 82 |
|
| 83 |
[[class.nested.type]] **Change:** In C++, a typedef name may not be
|
| 84 |
+
redeclared in a class definition after being used in that definition.
|
| 85 |
|
| 86 |
Example:
|
| 87 |
|
| 88 |
``` cpp
|
| 89 |
typedef int I;
|
|
|
|
| 93 |
};
|
| 94 |
```
|
| 95 |
|
| 96 |
**Rationale:** When classes become complicated, allowing such a
|
| 97 |
redefinition after the type has been used can create confusion for C++
|
| 98 |
+
programmers as to what the meaning of `I` really is. **Effect on
|
| 99 |
original feature:** Deletion of semantically well-defined feature.
|
| 100 |
Semantic transformation. Either the type or the struct member has to be
|
| 101 |
renamed. Seldom.
|
| 102 |
|