Re: How to use VARIANT Structure of C on MAC OSX and XCODE
site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com You can get therapy for that. I have implemented Variant structure on MAC but it gives error VARIANT V; V.vt = VAR_INT; = Mike _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... On May 8, 2006, at 12:03 PM, "Gaurav Kumar" <gaurav.kumar@spsoftindia.com> wrote I want Variant type structure as is in C which can accept any data type. 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. 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. This email sent to site_archiver@lists.apple.com
participants (1)
-
Michael Smith