Skip to content

Latest commit

 

History

History
46 lines (30 loc) · 2.22 KB

j-default-char-type-is-unsigned.md

File metadata and controls

46 lines (30 loc) · 2.22 KB
description title ms.date f1_keywords helpviewer_keywords ms.assetid
Learn more about: /J (Default char Type Is unsigned)
/J (Default char Type Is unsigned)
11/04/2016
VC.Project.VCCLCompilerTool.DefaultCharIsUnsigned
VC.Project.VCCLWCECompilerTool.DefaultCharIsUnsigned
/j
defaults, char type
char data type
-J compiler option [C++]
/J compiler option [C++]
J compiler option [C++]
default char type is unsigned
50973667-6638-491e-9c41-bff73acae19f

/J (Default char Type Is unsigned)

Changes the default char type from signed char to unsigned char, and the char type is zero-extended when it is widened to an int type.

Syntax

/J

Remarks

If a char value is explicitly declared as signed, the /J option does not affect it, and the value is sign-extended when it is widened to an int type.

The /J option defines _CHAR_UNSIGNED, which is used with #ifndef in the LIMITS.h file to define the range of the default char type.

ANSI C and C++ do not require a specific implementation of the char type. This option is useful when you are working with character data that will eventually be translated into a language other than English.

Note

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.

To set this compiler option in the Visual Studio development environment

  1. Open your project's Property Pages dialog box. For details, see Set C++ compiler and build properties in Visual Studio.

  2. Select the Configuration Properties > C/C++ > Command Line property page.

  3. In Additional Options, enter the /J compiler option.

To set this compiler option programmatically

  • See xref:Microsoft.VisualStudio.VCProjectEngine.VCCLCompilerTool.DefaultCharIsUnsigned%2A.

See also

MSVC Compiler Options
MSVC Compiler Command-Line Syntax
Set C++ compiler and build properties in Visual Studio