Re: [chrony-dev] GCC issue |
[ Thread Index |
Date Index
| More chrony.tuxfamily.org/chrony-dev Archives
]
- To: chrony-dev@xxxxxxxxxxxxxxxxxxxx
- Subject: Re: [chrony-dev] GCC issue
- From: worley@xxxxxxxxxxxx (Dale R. Worley)
- Date: Tue, 21 Jan 2014 17:21:06 -0500
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net; s=q20121106; t=1390342868; bh=qDOZTUdcy+c7oZDFuJKCvtoB/0ViyAB+G8XIHSWYm7I=; h=Received:Received:Received:Received:Date:Message-Id:From:To: Subject; b=W/RANybusBuKYEWAkkcZ9derSiLbVZwkgS2k18ExZ2awSRvdPN+4qnpDJYOCvcnWd buL1DXu7SPHFSVTIa3cXwwtWyxGBceRpNsf61jILDzKvlMiGJ3IWWYCAz2aSNKtTbO EaRMW6UzbijDvIiCxVhOnQUyqETx15tsXRajWrm2Xl+kFbW09pjViuGn6r3Ljt2VE1 ++67qz0dkjb+sBVwx0gi3/lAXz3ZUnGJZ1975KtuMruHDP5QehCz29Ds0p9uUUYdTh Y0l2fBEMvGjwuNeLEQXBKuXBMNE1HL4mEzn7QOtIG9MPKw1dErfw2fYacOrpNyA8cW Ft8qTd2ZIMfOg==
> From: Bill Unruh <unruh@xxxxxxxxxxxxxx>
> > Apparently there is no sequence point with the | operator and the
> > compiler is free to use any order.
> >
> > http://en.wikipedia.org/wiki/Sequence_point
>
> Lets hope that
> r=(fprintf()<0) ;
> r|=fclose()
> does not get optimized away by the compiler, and then one runs into the same
> problem.
My understanding is that the fclose() is required to be executed
regardless of the value of r at that point -- "|" is not a
short-circuit operator.
I would like to see the code as:
> r=(fprintf()<0) ;
> r|=(fclose() == EOF);
fclose() returns 0 on success and EOF on failure, and it's generally
not a good idea to use "|" on values whose bit-pattern you do not
understand.
Dale
--
To unsubscribe email chrony-dev-request@xxxxxxxxxxxxxxxxxxxx with "unsubscribe" in the subject.
For help email chrony-dev-request@xxxxxxxxxxxxxxxxxxxx with "help" in the subject.
Trouble? Email listmaster@xxxxxxxxxxxxxxxxxxxx.