Subject: Re: bin/23988: egcs: cc -traditional totally broken
To: Christian Biere <christianbiere@gmx.de>
From: David Laight <david@l8s.co.uk>
List: netbsd-bugs
Date: 01/05/2004 20:26:12
On Mon, Jan 05, 2004 at 12:55:10PM +0100, Christian Biere wrote:
> [Please, don't set the Reply-To header to an invalid address!]
> 
> vax@carolina.rr.com wrote:
> > void tmp(void) {
> >   int fd;
> >   fd = open("/dev/null", 2, 0);
> >   printf("%d, %d, %d\n", fd, lseek(fd, 0, 0), errno);
> > }
> 
> CMIIW, in C function parameters get evaluated from right to left. So
> the errno as printed was set by open() or something before but not
> by lseek()

Wrong...

The order is undefined, so the above can (and will on some systems)
print the value of errno after lseek() has been called.

> A function may alter errno even if it didn't fail because
> you have to ignore the value of errno in case of success.

Generally true...


	David

-- 
David Laight: david@l8s.co.uk