-qupconv
Category
Pragma equivalent
#pragma options [no]upconv
Purpose
Specifies whether the unsigned specification is preserved when integral promotions are performed.
When noupconv is in effect, any unsigned type smaller than an int is converted to int during integral promotions. When upconv is in effect, these types are converted to unsigned int during integral promotions. The promotion rule does not apply to types that are larger than int.
Defaults
- -qnoupconv for all language levels except classic or extended
- -qupconv when the classic or extended language levels are in effect
Usage
Sign preservation is provided for compatibility with older dialects of C. The ANSI C standard requires value preservation as opposed to sign preservation.
Predefined macros
None.
Examples
To compile myprogram.c so
that all unsigned types smaller than 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;
}