C only


Preserves the unsigned specification when performing integral promotions.


Read syntax diagramSkip visual syntax diagram        .-noupconv-.
>>- -q--+-upconv---+-------------------------------------------><

See also #pragma options.


The -qupconv option promotes any unsigned type smaller than an int to an unsigned int instead of to an int.

Sign preservation is provided for compatibility with older dialects of C. The ANSI C standard requires value preservation as opposed to sign preservation.


The default is -qnoupconv, except when -qlanglvl=extc89, 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 bit field or their signed orunsigned types, or an enumeration type to an int. Otherwise, the type is converted to an unsigned int.


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"); 
    printf("Unsignedness-preserving rules in effect\n"); 
  return 0; 

Related information