[haiku-commits] Re: haiku: hrev52133 - src/apps/mediaconverter

  • From: looncraz <looncraz@xxxxxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Wed, 25 Jul 2018 16:51:17 -0500

My usual solution regarding unsetting unions is to add a method to the union and just set the largest value directly.


union SomeUnion {
    void Unset() {
        D = 0;
    }

    int A;
    float B;
    uint32 C;
    uint64 D;
};

If the largest member of the union changes sizes, I adjust the Unset() appropriately.

Would this work here?

--The loon

Other related posts: