On Fri, 13 Dec 2002, Kevin P. Fleming wrote:
> > Very unlikely, the C-Compiler should generate code that does short
> > evaluation. So the ++nonmail_command_count SHOULD be only triggered if
> > !p->is_mail_cmd is set.
> >
> However (and I am not an expert here), combining pre/post-increment with other
> operations is fraught with danger. Many C texts will tell you that the actual
> sequence of events that will occur here is "undefined", meaning it's up to the
> implementers of the compiler to decide which order things will happen. That may
> be why this problem is occurring on some systems and not others.
Exim does assume that it will be compiled by a standard-conforming
compiler. The standard is very clear about the meaning of &&. It says
"the && operator guarantees left-to-right evaluation".
Nevertheless, as I was fixing the bug that provoked this thread (which
was not a ++ problem), I have rewritten the code to be clearer. There's
always a benefit if keeping the code simple if one can.
--
Philip Hazel University of Cambridge Computing Service,
ph10@??? Cambridge, England. Phone: +44 1223 334714.