CPP 1.1 NO IDEA Avatar
  1. OMG Issue

CPP11 — don't understand the last paragraph of 1.18.2:

  • Key: CPP11-116
  • Legacy Issue Number: 3080
  • Status: closed  
  • Source: Floorboard Software ( Jonathan Biggar)
  • Summary:

    "Both interfaces that are derived from one or more abstract interfaces,
    and valuetypes that support one or more abstract interfaces support
    implicit widening to the _ptr type for each abstract interface base
    class. Specifically, the T* for valuetype T and the T_ptr type for
    interface type T support implicit widening to the Base_ptr type for
    abstract interface type Base. The only exception to this rule is for
    valuetypes that directly or indirectly support one or more regular
    interface types (see Section 1.17.9, Valuetype Inheritance, on page
    1-83). In these cases, it is the object reference for the valuetype, not
    the pointer to the valuetype, that supports widening to the abstract
    interface base."

    This seems to prohibit widening from a valuetype pointer to an abstract
    interface _ptr if the valuetype happens to support a normal interface.
    I don't understand the restriction. This seems to prohibit the
    programmer making a choice of using value or reference semantics in the
    case of diamond inheritence of an abstract interface:

    // IDL
    abstract interface A {
    };

    interface I : A {
    };

    valuetype V1 : supports A {
    };

    valuetype V2 : supports I {
    };

    This means that I must always pass V2 valuetypes by reference to
    operations expecting an A, and cannot choose to pass V2 valuetypes by
    value instead. Why was this restriction added and what would be the
    problem with relaxing it in this case?

  • Reported: CPP 1.0 — Sat, 4 Dec 1999 05:00 GMT
  • Disposition: Resolved — CPP 1.1
  • Disposition Summary:

    see below

  • Updated: Fri, 6 Mar 2015 20:58 GMT