I'm migrating a Visual C++ project which uses ATL/MFC from VS2010 to VS2013. The project compiles with /J
("assume char
is unsigned"), and there is too much code that may or may not rely on that fact to easily remove the compiler flag.
Under VS2013, /J
causes a compiler error in atldef.h: ATL doesn't support compilation with /J or _CHAR_UNSIGNED flag enabled
. This can be suppressed by defining _ATL_ALLOW_UNSIGNED_CHAR
. Microsoft mention this in the MSDN documentation for /J
, along with the vague statement: "If you use this compiler option with ATL/MFC, an error might be generated. Although you could disable this error by defining _ATL_ALLOW_CHAR_UNSIGNED, this workaround is not supported and may not always work."
Does anyone know under what circumstances it is safe or unsafe to use _ATL_ALLOW_CHAR_UNSIGNED
?
#define
and#undef
as required for your own non-ATL code? – Adagio#define
and#undef
what, exactly? – Bluh#define
and#undef _CHAR_UNSIGNED
exactly. That's what the/J
option does. Or maybe .. MS Connect says "The /J switch controls the signed-ness of char. Setting the define is a side-effect of passing /J in that it is used by limit.h, but just setting the macro does not change the behavior of char" which is more worrying. – Adagio