This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

question about anonymous union usage


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 Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]