IDL4-CPP 1.0b2 FTF Avatar
  1. OMG Issue

IDL4CPP — Implicit default and constructor

  • Key: IDL4CPP-32
  • Status: open  
  • Source: Remedy IT ( Johnny Willemsen)
  • Summary:

    Spec says:

    If the union has a default case, the default constructor shall initialize the discriminator, and the selected
    member field following the initialization rules described in Clause 7.2.4.3.1. If it does not, the default
    constructor shall initialize the union to the first discriminant value specified in the IDL definition.

    But when there is an implicit default member, that should be selected, for example, the example below (

      enum DataType
      {
        dtEmpty,
        dtLong,
        dtShort,
        dtString,
        dtPoint,
        dtTrack,
        dtGlobal
      };
    
      union Data switch (DataType)
        {
          case dtLong: long longData;
          case dtShort: short shortData;
          case dtString: string stringData;
          case dtPoint: string pointData;
          case dtTrack: string trackData;
          case dtGlobal: string globalData;
          // by default (implicit), empty union
        };
    
  • Reported: IDL4-CPP 1.0b1 — Tue, 16 Jan 2024 09:36 GMT
  • Updated: Tue, 19 Mar 2024 19:48 GMT