[net.lang.c] VAX bug: unsigned short comparision with integer constant

joe@teltone.UUCP (Joe) (11/06/84)

The following program demonstrates an interesting bug on the VAX
(4.1 and 4.2 BSD UNIX).  The comparison of unsigned short x = 0xffff
and the integer constant 0xffffffff should fail as type conversion
should convert x to 0x0000ffff and the integer constant should
remain 0xffffffff.  The enclosed piece of code shows that this is not
the case.  The code does compile correctly on a Pyramid.
=====================================================================
/*  Demo of unsigned short comparision with integer constant */

#include <stdio.h>

main()
{
    unsigned short x;
    int y;

    x = 0xffff; 

    if (x == 0xffffffff)
	printf("x == 0xffffffff, x = %x, 0xffffffff = %x\n", x, 0xffffffff);
    else
	printf("x != 0xffffffff, x = %x, 0xffffffff = %x\n", x, 0xffffffff);
}