• 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: Missing braces? I don't see where
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Missing braces? I don't see where


  • Subject: Re: Missing braces? I don't see where
  • From: Chris Suter <email@hidden>
  • Date: Wed, 28 Oct 2009 09:36:11 +1100

Hi Dan,

On Wed, Oct 28, 2009 at 9:24 AM, Dan Korn <email@hidden> wrote:
I might be wrong, but I don't think you can initialize more than one "member" of a union like that in the same way you initialize a struct.  How would the compiler know you're initializing an RGBCOMPONENT instead of a CMYKCOMPONENT anyway?

The initialiser applies to the first named member in a union unless there's a designator (C only).

In C you can specify which member you want to initialise, e.g.

  static struct COLORDATA cd = { 0, false, { .rgb = { 0xffff, 0xffff, 0xffff } } };

However, you can't use that in C++. I'm not sure exactly why but you can always create a constructor instead (and perhaps that's what they're encouraging you to do).

Kind regards,

Chris

 _______________________________________________
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

  • Follow-Ups:
    • Re: Missing braces? I don't see where
      • From: Jens Alfke <email@hidden>
References: 
 >Missing braces? I don't see where (From: Steve Mills <email@hidden>)
 >Re: Missing braces? I don't see where (From: Dan Korn <email@hidden>)

  • Prev by Date: Re: Missing braces? I don't see where
  • Next by Date: Re: Missing braces? I don't see where
  • Previous by thread: Re: Missing braces? I don't see where
  • Next by thread: Re: Missing braces? I don't see where
  • Index(es):
    • Date
    • Thread