C 1.1 NO IDEA Avatar
  1. OMG Issue

C11 — How to allocate storage for a basic type you wish to place in an any?

  • Key: C11-82
  • Legacy Issue Number: 2533
  • Status: closed  
  • Source: Anonymous
  • Summary:

    Summary: Under the C mapping how do you allocate storage for a basic type
    you wish to place in an any.

    Consider inserting a long into an Any.

    Do you do this: solution 1

    any->_type = TC_long;
    any->_value = CORBA_alloc(sizeof(CORBA_long));

    or this: solution 2

    any->_type = TC_long;
    any->value = CORBA_long_alloc();

    One vendor argues that the text below supports solution 2. However
    as a long is not a constructed type solution 1 seems more natural.

    >From "17.8 Mapping Considerations for Constructed Types" of CORBA 2.1
    specification:

    "For types whose parameter passing modes require heap allocation,
    an ORB implementation will provide allocation functions. These types
    include variable-length struct, variable-length union, sequence, any,
    string, wstring and array of a variable-length type. The return value
    of these allocation functions must be freed using CORBA_free(). For
    one of these listed types T, the ORB implementation will provide
    the following type-specific allocation function:

    T *T__alloc(); /* C */"

  • Reported: C 1.0b1 — Fri, 12 Mar 1999 05:00 GMT
  • Disposition: Resolved — C 1.1
  • Disposition Summary:

    urgent resolution, issue resolved

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