### Controlling C++ Extensions

The C++ compiler has additional extensions that you can activate using the pragma cpp_extensions.

If you enable this pragma, the compiler lets you use the following extensions to the ISO C++ standard:

- Anonymous struct objects (ISO C++, §9)

> #pragma cpp_extensions on
> void foo()
> {
> union {
> long hilo;
> struct { short hi, lo; };
> // anonymous struct
> };
> hi=0x1234;
> lo=0x5678;
> // hilo==0x12345678
> }

- Unqualified pointer to a member function (ISO C++, §8.1)

> #pragma cpp_extensions on
> struct Foo { void f(); }
> void Foo::f()
> {
> void (Foo::*ptmf1)() = &Foo::f;
> // ALWAYS OK
> void (Foo::*ptmf2)() = f;
> // OK if you enabled cpp_extensions.
> }

To check this setting, use the __option (cpp_extensions). By default, this setting is off.

See Checking Option Settings for information on how to use this directive.