CPP 1.3 NO IDEA Avatar
  1. OMG Issue

CPP13 — Any insertion for Boolean/Octet/Char

  • Key: CPP13-44
  • Legacy Issue Number: 3567
  • Status: open  
  • Source: Triodia Technologies Pty Ltd ( Michi Henning)
  • Summary:

    The mapping is currently a bit ambiguous about the insertion/extraction
    operators for Any. It says:

    Assuming that boolean, char, and octet all map the C++ type
    unsigned char, the private and unimplemented operator<<= and
    operator>>= functions for unsigned char will cause a compile-time
    error if straight insertion or extraction of any of the
    boolean, char, or octet types is attempted.

    This is ambiguous. It is not clear what is qualified by the first part
    of the sentence "Assuming that...". It could qualify all of the paragraph,
    in which case the interpretation is:

    Only on platform where these three types indeed map to the same
    C++ type will it be necessary to have these unimplemented operators.

    // C++ Octet
    oct = 040;
    Any any;
    any <<= oct; // this line will not compile
    any <<= Any::from_octet(oct); // but this one will

    This is unambiguous, but it doesn't make it clear whether this will be
    the case for all mapping implementations, or only those where the
    IDL types map to ambiguous C++ types.

    It is important to note that the previous example is only one
    possible implementation for these helpers, not a mandated one.
    Other compliant implementations are possible, such as providing
    them via in-lined static any member functions if boolean, char,
    and octet are in fact mapped to distinct C++ types. All
    compliant C++ mapping implementations must provide these helpers,
    however, for purposes of portability.

    Again, this is slightly ambiguous because, even though it requires the
    presence of the helpers, it doesn't make any statement about whether the
    prohibition of the direct insertion operators is mandatory for all

    I would suggest to clarify the text to state that direct insertion/extraction
    of Bool, Octet, and Char must fail with a compile-time error, regardless
    of how these types are mapped.

  • Reported: CPP 1.1 — Tue, 18 Apr 2000 04:00 GMT
  • Updated: Fri, 6 Mar 2015 20:57 GMT