Any side effect of not using USES_CONVERSION

Posted by Yan Cheng CHEOK on Stack Overflow See other posts from Stack Overflow or by Yan Cheng CHEOK
Published on 2010-06-08T03:20:56Z Indexed on 2010/06/08 3:32 UTC
Read the original article Hit count: 170

Filed under:
|

Recently, I have a utilities function of

// T2CA
#include "ATLCONV.H"

std::string Utils::CString2String(const CString& cString) 
{
#if _MSC_VER > 1200
    // Convert a TCHAR string to a LPCSTR
    // construct a std::string using the LPCSTR input
    CT2CA tmp(cString);
    std::string strStd (tmp);
#else
    // Deprecated in VC2008.
    // construct a std::string using the LPCSTR input

    std::string strStd (T2CA (cString));
#endif

    return strStd;
}

I do several simple test it seems work fine. However, when I google around, I see most usage of T2CA in VC6, before they call, they will invoke

USES_CONVERSION;

Is there any thing I had missed out? Shall I invoke my function by :

#else
    // Deprecated in VC2008.
    // construct a std::string using the LPCSTR input
    USES_CONVERSION;
    std::string strStd (T2CA (cString));
#endif

© Stack Overflow or respective owner

Related posts about c++

Related posts about vc++