Next: , Previous: C Struct, Up: C mappings


6.1.8 Mapping for union types

GenoM IDL unions map onto C structs. The discriminator in the enum is referred to as _d, the union itself is referred to as _u.

For instance, the following IDL:

      union u switch(long) {
         case 1: long a;
         case 2: float b;
         default: char c;
      };

would map into

      typedef struct {
         int32_t _d;
         union {
            int32_t a;
            float b;
            char c;
         } _u;
      } u;