Summary
You must be especially careful when using the
BSTR string type because it has numerous special
semantics. The ATL CComBSTR class manages many of the
special semantics for you and is quite useful. However, the class
cannot compensate for the poor decision that, to the C++ compiler,
equates the OLECHAR* and BSTR types. You always
must use care when using the BSTR type because the
compiler will not warn you of many pitfalls.
The CString class is poised to become
the new workhorse for string processing in ATL. It is now a shared
class with the MFC library and offers a host of powerful functions
for manipulating strings in ways that would be very cumbersome and
error prone with other string classes. Additionally,
CString provides for the customization of string
allocation via the IAtlStringMgr interface and a default
implementation of that interface in CAtlStringMgr.
|