RAD Studio |  |

#pragma anon_struct

Syntax

Copy Code

    #pragma anon_struct on
    #pragma anon_struct off

Description

The anon_struct directive allows you to compile anonymous structures embedded in classes.

Copy Code

    #pragma anon_struct on

Copy Code

    struct S {
       int i;
       struct {  // Embedded anonymous struct
          int   j ;
          float x ;
       };
       class {  // Embedded anonymous class
       public:
          long double ld;
       };
       S() { i = 1; j = 2; x = 3.3; ld = 12345.5;}
    };
    #pragma anon_struct off

Copy Code

    void main()

Copy Code

    {
       S mystruct;
       mystruct.x = 1.2;  // Assign to embedded data.
    }

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!