Date: Wed, 26 Jan 2005 11:43:56 +0100 From: Erik Trulsson <ertr1013@student.uu.se> To: Michael Sierchio <ducatista@camber-thrust.net> Cc: lioux@freebsd.org Subject: Re: FreeBSD Port: qmail-1.03_3 Message-ID: <20050126104355.GA3837@falcon.midgard.homeip.net> In-Reply-To: <41F72C02.7060901@camber-thrust.net> References: <41F6F431.6060005@tenebras.com> <1106704507.16118.14.camel@shumai.marcuscom.com> <41F72C02.7060901@camber-thrust.net>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Jan 25, 2005 at 09:34:58PM -0800, Michael Sierchio wrote: > Joe Marcus Clarke wrote: > > >>- while ((k > i) && (cmds.s[k - 1] == ' ') || (cmds.s[k - 1] == '\t')) > >>+ while ((k > i) && ((cmds.s[k - 1] == ' ') || (cmds.s[k - 1] == > >>'\t'))) > > > >Actually, if k is less than or equal to i and cmds.s[k-1] is a tab, then > >the first bit of code evaluates to true while the second evaluates to > >false. I haven't looked at the rest of the code, but those statements > >are semantically different, and I think the second is more correct. > > You're simply mistaken. > > ( 1 && 0 || 1 ) will ALWAYS evaluate to 1 on any ANSI C compiler. No, it will evaluate to 0. && has higher precedence than ||. (x && y || z) is equivalent to ((x && y) || z) which is different from (x && (y || z)). -- <Insert your favourite quote here.> Erik Trulsson ertr1013@student.uu.se
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050126104355.GA3837>