-qchars

Category

Floating-point and integer control

Pragma equivalent

#pragma options chars, #pragma chars

Purpose

Determines whether all variables of type char are treated as either signed or unsigned.

Syntax

Read syntax diagramSkip visual syntax diagram
Option syntax

                  .-unsigned-.   
>>- -q--chars--=--+-signed---+---------------------------------><

Read syntax diagramSkip visual syntax diagram
Pragma syntax

                        .-unsigned-.      
>>-#--pragma--chars--(--+-signed---+--)------------------------><

Defaults

-qchars=unsigned

Parameters

unsigned
Variables of type char are treated as unsigned char.
signed
Variables of type char are treated as signed char.

Usage

Regardless of the setting of this option or pragma, the type of char is still considered to be distinct from the types unsigned char and signed char for purposes of type-compatibility checking.

The pragma must appear before any source statements. If the pragma is specified more than once in the source file, the first one will take precedence. Once specified, the pragma applies to the entire file and cannot be disabled; if a source file contains any functions that you want to compile without #pragma chars, place these functions in a different file.

Predefined macros

Examples

To treat all char types as signed when compiling myprogram.c, enter:
xlc myprogram.c -qchars=signed