anonymousStructs Language Option (C++)

Syntax: Default:
lang(anonymousStructs[, yes])
lang(anonymousStructs, no)
lang(anonymousStructs[, yes])

This option controls whether anonymous structs and anonymous classes are allowed in your C++ source.

By default, VisualAge C++ allows anonymous structs. This is an extension to the C++ standard and gives behavior that is compatible with the C++ compilers provided by Microsoft Visual C++.

Anonymous structs typically are used in unions, as in the following code fragment:

union U {
   struct {
      int i:16;
      int j:16;
   };
   int k;
} u;
// ...
u.j=3;

When this option is set to yes, you receive a warning if your code declares an anonymous struct. You can suppress the warning with report(disable, "CPPC0017"). When you build with lang(anonymousStructs, no) an anonymous struct is flagged as an error.

Set anonymousStructs to no for compliance with standard C++.



Incremental C++ Build
Configuration Files


Set Build Options
Build


Language Options for C++
Build Options for Compliance With the C++ Standard
Build Options for Compatibility with Old C++ Compilers