RAD Studio
ContentsIndex
PreviousUpNext
#pragma anon_struct

Syntax

#pragma anon_struct on
#pragma anon_struct off

Description 

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

#pragma anon_struct on

 

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

 

void main()

 

{
   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!