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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.