Re: How to use VARIANT Structure of C on MAC OSX and XCODE
Re: How to use VARIANT Structure of C on MAC OSX and XCODE
- Subject: Re: How to use VARIANT Structure of C on MAC OSX and XCODE
- From: Michael Smith <email@hidden>
- Date: Mon, 8 May 2006 19:53:13 -0700
On May 8, 2006, at 12:03 PM, "Gaurav Kumar"
<email@hidden> wrote
I want Variant type structure as is in C which can accept any data
type.
You can get therapy for that.
Is there any replacement for Variant is on Mac or we can use them
same as in
MFC Classes.
Use the language as it was intended. VARIANT is a bad attempt at
handling opaque data.
A slightly more mature approach is the use of (void *) in conjunction
with out-of-band type information (since the singleton argument is
just a special case of the arbitrary argument set).
Better still is to take advantage of the language's type-safety and
encapsulation features; if you must pass variant data, use a
collection structure with a union of the full argument sets as a
member. At least this gives you basic protection against mis-matched
collections, and some assurance that you're looking at the right
container in the first place.
I have implemented Variant structure on MAC but it gives error
VARIANT V;
V.vt = VAR_INT;
It gives error as VAR_INT is not declared and vt is of non type
void *.
That is because you do not appear to have "implemented" anything
other than a compiler error message generator. It looks like you
have attempted to *use* the (nonexistent on Mac OS X) VARIANT type.
If I can use Variant on MAC, please provide one or two examples or
some
other thing that I can use to accept any primitive data type in a
single
data type.
Happily, Mac OS X does not support anything quite this disgusting.
You will need to either implement (note: implement, not use) an
equivalent as per other suggestions in this thread, or (better but
much less likely) fix the code that you are obviously porting so that
it doesn't contain any more of this bogosity.
= Mike
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden