question about anonymous union usage

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I'm using g++ v3.4.1.

I'm considering using an anonymous union in the following fashion:

  class SomeClass
  {
    ....
  private:
    bool isPseudo_;
    union {
      LayoutVertex *layoutVertex_;
      PseudoVertex *pseudoVertex_;
    };
  }

Both LayoutVertex and PseudoVertex have the same methods.

Only in the constructors of SomeClass will I have to code in a way that differenciates between layoutVertex_ and psuedoVertex_.

My question is can I safely use layoutVertex_ elsewhere even if its initialized with a PsuedoVertex object?


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux