Option Type | Default Value | #pragma options | C | C++ |
-qoption | noupconv* | UPCONV | x |
Syntax
-qupconv | -qnoupconv UPCONV | NOUPCONV
Purpose
Preserves the unsigned specification when performing integral
promotions.
Notes
The -qupconv option promotes any unsigned type
smaller than an int to an unsigned int instead of to an int.
Unsignedness preservation is provided for compatibility with older dialects of C. The ANSI C standard requires value preservation as opposed to unsignedness preservation.
Default
The default is -qnoupconv, except when -qlanglvl=ext,
in which case the default is -qupconv. The compiler does not preserve the
unsigned specification.
The default compiler action is for integral promotions to convert a char, short int, int bitfield or their signed or unsigned types, or an enumeration type to an int. Otherwise, the type is converted to an unsigned int.
Example
To compile myprogram.c so that all unsigned types smaller than an int
are converted to unsigned int, enter:
xlC myprogram.c -qupconv
The following short listing demonstrates the effect of -qupconv:
#include <stdio.h> int main(void) { unsigned char zero = 0; if (-1 <zero) printf("Value-preserving rules in effect\n"); else printf("Unsignedness-preserving rules in effect\n"); return 0; }
List of Batch Compiler Options and Their Defaults
Equivalent Batch Compile-Link and Incremental
Build Options