I come across some code where a LPCTSTR is assigend to a _bstr_t. As a BSTR does provide length information according to MSDN and a common TCHAR pointer does not I am unsure if the following code is safe. I did not find a clue that there is an overloaded operator that makes this possible safely, however this seems to work without any obvious errors, but it might be undefined behaviour.
Example:
// pComObject->Property is of type _bstr_t
pComObject->Property = (LPCTSTR) string;
Yes,
_bstr_thas an operator= which accepts a NULL-terminated string (both wide and multibyte), so this is safe