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]

problem with nameless structs and unions


Hi,

I'm already sorry, if this is the wrong place to send this question but
anyway, here I go:

take this simple structure for example

struct vec {
  union {
    int v[3];
    struct {
      int x,y,z;
    };
  };
};

GCC doesn't seem to support nameless structures inside unions for
example..

It just reports this when compiling the above code:
...anonymous class type not used to declare any objects

This would be very useful in many situations.
Is there any way to go round this flaw, to achieve the same functionality
as the above structure should provide, that is accessing the same elements
eith either indexing them or using plain vector component names?

-Tuukka Lehtonen


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]