tags:

views:

980

answers:

2

I am writing a COM object in C++ using ATL and am not sure whether I should be using VARIANT_BOOL for my methods/properties or not. The object will be called by other C++ apps but I cannot rule out usage from .NET.

I can stick to good old BOOL (which IIRC is simply an unsigned int) but as VARIANT_BOOL is there, shouldn't I be using it? If I do use it, and call these methods from a C++ app, I have to add extra code as a VARIANT_BOOL is not like a 'normal' boolean and I have to check for VARIANT_TRUE and VARIANT_FALSE values.

Is VARIANT_BOOL an anachronism that I can forget or should I stick with it?

+4  A: 

Raymond Chen has made a good post on that matter (as usual).

arul
A: 

VARIANT_BOOL will make your COM component VB6 friendly. COM never really seemed to be made for doing things simply in C++, but more focus on making it easy to use from VB. Not sure if this still applies to .net access of a COM component or not.

crashmstr