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
Copy file name to clipboardExpand all lines: docs/error-messages/compiler-warnings/compiler-warning-levels-2-and-4-c4200.md
+7-8Lines changed: 7 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -9,21 +9,21 @@ helpviewer_keywords: ["C4200"]
9
9
10
10
> nonstandard extension used: zero-sized array in struct/union
11
11
12
-
Indicates that a structure or union contains an array that has zero size.
13
-
14
-
Declaration of a zero-sized array is a Microsoft extension. This causes a Level-2 warning when a C++ file is compiled and a Level-4 warning when a C file is compiled. C++ compilation also gives this warning: "Cannot generate copy-ctor or copy-assignment operator when UDT contains a zero-sized array." This example generates warning C4200:
12
+
C++ only:
13
+
> This member will be ignored by a defaulted constructor or copy/move assignment operator
14
+
15
+
This warning indicates that a structure or union contains an array that has zero size. Declaration of a zero-sized array is a nonstandard compiler extension. This causes a Level-2 warning when a C++ file is compiled and a Level-4 warning when a C file is compiled. This example generates warning C4200:
15
16
16
17
```cpp
17
18
// C4200.cpp
18
19
// compile by using: cl /W4 c4200.cpp
19
20
structA {
21
+
int len;
20
22
int a[0]; // C4200
21
23
};
22
-
int main() {
23
-
}
24
24
```
25
25
26
-
This non-standard extension is often used to interface code with external data structures that have a variable length. If this scenario applies to your code, you can disable the warning:
26
+
This nonstandard extension is often used to interface code with external data structures that have a variable length. If this scenario applies to your code, you can disable the warning:
27
27
28
28
## Example
29
29
@@ -32,8 +32,7 @@ This non-standard extension is often used to interface code with external data s
0 commit comments