Partager via


_ATL_CSTRING_EXPLICIT_CONSTRUCTORS

Makes certain CString constructors explicit, preventing any unintentional conversions.

_ATL_CSTRING_EXPLICIT_CONSTRUCTORS

Remarks

When this is defined, all CString constructors that take a single parameter are compiled with the explicit keyword, which prevents implicit conversions of input arguments. This means for example, that when _UNICODE is defined, if you attempt use a char* string as a CString constructor argument, a compiler error will result. Use this macro in situations where you need to prevent implicit conversions between narrow and wide string types.

By using the _T macro on all constructor string arguments, you can define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS and avoid compile errors regardless of whether _UNICODE is defined.

See Also

Reference

CStringT Class

Other Resources

Compiler Options Macros