Compiler bug? (return values from functions)

Per Westerlund per at chalmers.UUCP
Thu Dec 4 06:50:39 AEST 1986


This small example does not behave as I expected on an NCR Tower XP,
3.00.02 (SysV):

unsigned char
a()
{
    int a, b;

    a = b = 0200;
    return a + b;
}

main()
{
    int	i;

    i = a();
    printf("%o\n", i);
}

On the Tower I get 0400, while on a Vax (4.2+) I get 0, which is what
I expected after having read K&R. Should I report this as an error?

			Per Westerlund
			Chalmers University of Technology
			Dept of Computer Sci.
			Sweden



More information about the Comp.lang.c mailing list