DDS-XTypes 1.3 RTF Avatar
  1. OMG Issue

DDSXTY13 — Setting of @default with @optional members

  • Key: DDSXTY13-26
  • Status: closed  
  • Source: Real-Time Innovations ( Dr. Gerardo Pardo-Castellote, Ph.D.)
  • Summary:

    The default value of an member defined with @optional is "not set".

    However it is possible to also apply the @optional annotation. In this situation should the value specified in the @default override the "not set" default?

    For example if MyStruct is specified as:

    @mutable
    struct myStruct {
      long m1;
      @optional @default(2) long m2;
    }
    

    Would the default value of m2 be "not set" or 2?

    At first glance it would seem that @default should override since if that was not the desired behavior then the user could just as well omit it. On the other hand, there seems to be a bit of ambiguity. Imagine m2 is not set by the sender, would the receiver then get "not set" or 2. If it gets 2, then how would a user ever detect the lack of m2 being set which is one of the goals of optionality.

  • Reported: DDS-XTypes 1.2 — Tue, 3 Jul 2018 15:27 GMT
  • Disposition: Resolved — DDS-XTypes 1.3
  • Disposition Summary:

    Do not allow a @default on an @optional member

    The @optional annotation is incompatible with the @default annotation. When both are set it should cause an error or at least a warning that @default is ignored.

  • Updated: Tue, 8 Oct 2019 17:55 GMT