Oracle® Solaris Studio 12.4: C User's Guide

Exit Print View

Updated: March 2015
 
 

6.3.4 Example: Same Result, No Warning

In the following code, assume that both unsigned short and unsigned char are narrower than int.

int f(void)
{
    unsigned short us;
    unsigned char uc;
    return uc < us;
}

In this example, both automatics are either promoted to int or to unsigned int, so the comparison is sometimes unsigned and sometimes signed. However, the C compiler does not warn you because the result is the same for the two choices.