• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: anonymous structs in union
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: anonymous structs in union


  • Subject: Re: anonymous structs in union
  • From: Peter Mulholland <email@hidden>
  • Date: Wed, 6 Jun 2007 08:43:41 +0100

Hello Luigi,

Wednesday, June 6, 2007, 8:02:16 AM, you wrote:

> Hi there,

> I have an union declaration as follows:

> typedef union _vec3
> {
>     struct {
>         float x,y,z;
>     };
>     struct {
>         float s,t,r;
>     };
>     float values[3];

> } t_vec3;

> When I use the following code:

> t_vec3 vector;

> vector.x = 1;
> vector.y = 2;
> vector.z = 3;

> X-code complains with this error:

> error: t_vec3' has no member named 'x'
> error: t_vec3' has no member named 'y'
> error: t_vec3' has no member named 'z'

> Does xcode have an option to support anonymous structs and unions ?

> Thank you.

> - Luigi

Try -fms-extensions in your C flags.

Also see here:

http://gcc.gnu.org/onlinedocs/gcc-4.0.4/gcc/Unnamed-Fields.html#Unnamed-Fields

--
Best regards,
 Peter                            mailto:email@hidden

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >anonymous structs in union (From: Luigi Castelli <email@hidden>)

  • Prev by Date: anonymous structs in union
  • Next by Date: Re: Dylib Dependencies (again)
  • Previous by thread: anonymous structs in union
  • Next by thread: xcode editor highlight colours in find/replace
  • Index(es):
    • Date
    • Thread