locked
Why do we need add these statements RRS feed

  • Question

  • Hello,everybody, when I read the USES_CONVERSION macro, its definition like this:

     

    #ifndef _DEBUG

    #define USES_CONVERSION int _convert; (_convert); UINT _acp = ATL::_AtlGetConversionACP() /*CP_THREAD_ACP*/; (_acp); LPCWSTR _lpw; (_lpw); LPCSTR _lpa; (_lpa)

    #else

    #define USES_CONVERSION int _convert = 0; (_convert); UINT _acp = ATL::_AtlGetConversionACP() /*CP_THREAD_ACP*/; (_acp); LPCWSTR _lpw = NULL; (_lpw); LPCSTR _lpa = NULL; (_lpa)

    #endif

     

    It seems all 4 local variables have been declared, but after its declaration,there is another statement with parentheses enclosed,like (_convert). I am curious why we need such additional statement of the variable? and why this variable  was enclosed in parentheses? Does anyone have idea.

     

    Friday, May 9, 2008 1:56 AM

Answers

  • It avoids C4101, "unreferenced local variable" at warning level 4 if you never made a conversion.  Not sure about the parens.
    Friday, May 9, 2008 4:02 AM

All replies

  • It avoids C4101, "unreferenced local variable" at warning level 4 if you never made a conversion.  Not sure about the parens.
    Friday, May 9, 2008 4:02 AM
  • Thank you, some reminding. it is helpful.

     

    Tuesday, May 13, 2008 2:21 AM