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?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With