[3515] in Athena Bugs

home help back first fref pref prev next nref lref last post

nxsaber diffeence from vax compiler

daemon@ATHENA.MIT.EDU (epeisach@ATHENA.MIT.EDU)
Fri Oct 27 14:14:40 1989

From: epeisach@ATHENA.MIT.EDU
Date: Fri, 27 Oct 89 14:14:11 -0400
To: bugs@ATHENA.MIT.EDU


The following program is interpretded diffently by the vax compiler and
nxsaber. Admittedly, order of operations are not defined below. but on a
vax I get only one string (Wilbur) printed, but in saber, I get a
warning during execution that n is not set. If I change the line, int n,
to int n=0, saber does not complain and prints both strings. It appears
to me that saber should give a warning in that case probably as well...

	-Ezra
----------------------------------------------------------------------

#include <strings.h>
#include <stdio.h>

main()
{
    int n;
    char *buf="Wilbur\n";

    if(write(2, buf, n=strlen(buf)) != n) {
	printf("Hello there\n");
    }
}

home help back first fref pref prev next nref lref last post