Home Comments

Suggest to support optional members in struct definition of slice.

jim.yefengjim.yefeng Member jim yefengOrganization: HonestySNSProject: Android AddressBook SNS
In currently class supports optional members in slice definition, it is very good to developer. Expect that the struct supports optional members.

Comments

  • matthewmatthew NL, CanadaMember Matthew NewhookOrganization: ZeroC, Inc.Project: Internet Communications Engine ✭✭✭
    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 [email protected] and we'll look into implementing support.
  • jim.yefengjim.yefeng Member jim yefengOrganization: HonestySNSProject: Android AddressBook SNS
    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 [email protected] 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.
Sign In or Register to comment.