Archived

This forum has been archived. Please start a new discussion on GitHub.

Suggest to support optional members in struct definition of slice.

In currently class supports optional members in slice definition, it is very good to developer. Expect that the struct supports optional members.

Comments

  • matthew
    matthew NL, Canada
    We had a long discussion about supporting optional with structs when we added support back in Ice 3.5. The problem is that the additional of optional to structs would make all structs 1 byte bigger when marshaled on the wire. For a large struct that is unimportant, but for a small struct it would be quite bad. For example:
    struct Version
    {
        byte major;
        byte minor;
    };
    

    This struct would all of a sudden be 50% bigger on the wire. We discussed a couple of solutions at the time but we didn't implement them. If this feature is important for you I would suggest you contact sales@zeroc.com and we'll look into implementing support.
  • matthew wrote: »
    We had a long discussion about supporting optional with structs when we added support back in Ice 3.5. The problem is that the additional of optional to structs would make all structs 1 byte bigger when marshaled on the wire. For a large struct that is unimportant, but for a small struct it would be quite bad. For example:
    struct Version
    {
        byte major;
        byte minor;
    };
    

    This struct would all of a sudden be 50% bigger on the wire. We discussed a couple of solutions at the time but we didn't implement them. If this feature is important for you I would suggest you contact sales@zeroc.com and we'll look into implementing support.

    I see,
    But the small struct is used seldom in product environment,
    And then the minimum protocol size is 14bits, the additional byte is 1/17, (14 bytes protocol + 1 major + 1 minor + 1 optional flag), about 5.88%. So I think it is worth.