From Jason Turner

[diff.dcl]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp1nrfv_ly/{from.md → to.md} +23 -28
tmp/tmp1nrfv_ly/{from.md → to.md} RENAMED
@@ -13,23 +13,23 @@ static struct S { // valid C, invalid in C++{}
13
  };
14
  ```
15
 
16
  **Rationale:** Storage class specifiers don’t have any meaning when
17
  associated with a type. In C++, class members can be declared with the
18
- `static` storage class specifier. Allowing storage class specifiers on
19
- type declarations could render the code confusing for users. **Effect on
20
- original feature:** Deletion of semantically well-defined feature.
21
- Syntactic transformation. Seldom.
22
 
23
  **Change:** In C++, `register` is not a storage class specifier.
24
  **Rationale:** The storage class specifier had no effect in C++.
25
  **Effect on original feature:** Deletion of semantically well-defined
26
  feature. Syntactic transformation. Common.
27
 
28
- **Change:** A C++ typedef name must be different from any class type
29
  name declared in the same scope (except if the typedef is a synonym of
30
- the class name with the same name). In C, a typedef name and a struct
31
  tag name declared in the same scope can have the same name (because they
32
  have different name spaces).
33
 
34
  Example:
35
 
@@ -58,35 +58,15 @@ Seldom.
58
  initialized in C++ but can be left uninitialized in C. **Rationale:** A
59
  const object cannot be assigned to so it must be initialized to hold a
60
  useful value. **Effect on original feature:** Deletion of semantically
61
  well-defined feature. Semantic transformation. Seldom.
62
 
63
- **Change:** Banning implicit `int`.
64
-
65
- In C++ a *decl-specifier-seq* must contain a *type-specifier*, unless it
66
- is followed by a declarator for a constructor, a destructor, or a
67
- conversion function. In the following example, the left-hand column
68
- presents valid C; the right-hand column presents equivalent C++:
69
-
70
- ``` cpp
71
- void f(const parm); void f(const int parm);
72
- const n = 3; const int n = 3;
73
- main() int main()
74
- ... ...
75
- ```
76
-
77
- **Rationale:** In C++, implicit int creates several opportunities for
78
- ambiguity between expressions involving function-like casts and
79
- declarations. Explicit declaration is increasingly considered to be
80
- proper style. Liaison with WG14 (C) indicated support for (at least)
81
- deprecating implicit int in the next revision of C. **Effect on original
82
- feature:** Deletion of semantically well-defined feature. Syntactic
83
- transformation. Could be automated. Common.
84
-
85
  **Change:** The keyword `auto` cannot be used as a storage class
86
  specifier.
87
 
 
 
88
  ``` cpp
89
  void f() {
90
  auto int x; // valid C, invalid C++{}
91
  }
92
  ```
@@ -221,5 +201,20 @@ sizeof(A) == sizeof(e) // in C++{}
221
  original feature:** Change to semantics of well-defined feature.
222
  Semantic transformation. Seldom. The only time this affects existing C
223
  code is when the size of an enumerator is taken. Taking the size of an
224
  enumerator is not a common C coding practice.
225
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
  };
14
  ```
15
 
16
  **Rationale:** Storage class specifiers don’t have any meaning when
17
  associated with a type. In C++, class members can be declared with the
18
+ `static` storage class specifier. Storage class specifiers on type
19
+ declarations can be confusing for users. **Effect on original feature:**
20
+ Deletion of semantically well-defined feature. Syntactic transformation.
21
+ Seldom.
22
 
23
  **Change:** In C++, `register` is not a storage class specifier.
24
  **Rationale:** The storage class specifier had no effect in C++.
25
  **Effect on original feature:** Deletion of semantically well-defined
26
  feature. Syntactic transformation. Common.
27
 
28
+ **Change:** A C++ *typedef-name* must be different from any class type
29
  name declared in the same scope (except if the typedef is a synonym of
30
+ the class name with the same name). In C, a *typedef-name* and a struct
31
  tag name declared in the same scope can have the same name (because they
32
  have different name spaces).
33
 
34
  Example:
35
 
 
58
  initialized in C++ but can be left uninitialized in C. **Rationale:** A
59
  const object cannot be assigned to so it must be initialized to hold a
60
  useful value. **Effect on original feature:** Deletion of semantically
61
  well-defined feature. Semantic transformation. Seldom.
62
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
63
  **Change:** The keyword `auto` cannot be used as a storage class
64
  specifier.
65
 
66
+ Example:
67
+
68
  ``` cpp
69
  void f() {
70
  auto int x; // valid C, invalid C++{}
71
  }
72
  ```
 
201
  original feature:** Change to semantics of well-defined feature.
202
  Semantic transformation. Seldom. The only time this affects existing C
203
  code is when the size of an enumerator is taken. Taking the size of an
204
  enumerator is not a common C coding practice.
205
 
206
+ **Change:** In C++, an *alignment-specifier* is an
207
+ *attribute-specifier*. In C, an *alignment-specifier* is a .
208
+
209
+ Example:
210
+
211
+ ``` cpp
212
+ #include <stdalign.h>
213
+ unsigned alignas(8) int x; // valid C, invalid C++{}
214
+ unsigned int y alignas(8); // valid C++{}, invalid C
215
+ ```
216
+
217
+ **Rationale:** C++ requires unambiguous placement of the
218
+ *alignment-specifier*. **Effect on original feature:** Deletion of
219
+ semantically well-defined feature. Syntactic transformation. Seldom.
220
+