Re: Missing braces? I don't see where
Re: Missing braces? I don't see where
- Subject: Re: Missing braces? I don't see where
- From: Dan Korn <email@hidden>
- Date: Tue, 27 Oct 2009 17:24:16 -0500
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?
And unless you're really hurting for memory, why use a union at all in
a modern app? Just have multiple members, only one of which is valid
at any given time. They don't need to all pile on top of each other
in memory. Especially since you seem to be compiling C++, which
offers much more elegant and safe ways of accomplishing polymorphism,
which can made be more memory-efficient than a union as well.
If you want to use low-level C-type constructs without the benefits of
C++, check out Objective-C ;^) .
Dan
On Oct 27, 2009, at 4:46 PM, Steve Mills wrote:
struct COLORDATA
{
COLORSPACE space;
bool useCMYKValues;
union
{
RGBCOMPONENT rgb;
CMYKCOMPONENT cmyk;
GRAYCOMPONENT gray;
XYZCOMPONENT xyz;
};
};
/depot/cmyk/creatortech/desktop/mac/C2Mac/../../../semiportlib/
GraphicUIAll.cpp:191:0 /depot/cmyk/creatortech/desktop/mac/
C2Mac/../../../semiportlib/GraphicUIAll.cpp:191: warning: missing
braces around initializer for 'PortLib::RGBCOMPONENT'
COLORDATA backgroundColor = { kRGBSpace, false, {0xFFFF, 0xFFFF,
0xFFFF} };
_______________________________________________
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