Date: Tue, 25 Jan 2005 22:06:39 -0800 From: Chris Pressey <cpressey@catseye.mine.nu> To: freebsd-ports@freebsd.org Subject: Re: FreeBSD Port: qmail-1.03_3 Message-ID: <20050125220639.2a83e7ed.cpressey@catseye.mine.nu> In-Reply-To: <41F72FBD.2040906@camber-thrust.net> References: <41F6F431.6060005@tenebras.com> <1106704507.16118.14.camel@shumai.marcuscom.com> <41F72FBD.2040906@camber-thrust.net>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 25 Jan 2005 21:50:53 -0800 Michael Sierchio <ducatista@camber-thrust.net> wrote: > Joe Marcus Clarke wrote: > > >>- 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 > > if k is less than or equal to i, none of the rest of the statements > are evaluated. Wow, then GCC must be REALLY REALLY broken! Observe: int a(int x) { printf("evaluating a\n"); return x; } int b(int x) { printf("evaluating b\n"); return x; } int c(int x) { printf("evaluating c\n"); return x; } int main() { printf("a(0) && b(5) || c(5) result: %d\n", a(0) && b(5) || c(5)); printf("a(1) && b(5) || c(5) result: %d\n", a(1) && b(5) || c(5)); } -------[ output ]------ evaluating a evaluating c a(0) && b(5) || c(5) result: 1 evaluating a evaluating b a(1) && b(5) || c(5) result: 1 -------[ output ]------ > They don't make C programmers like they used to! You can say that again! -Chris
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050125220639.2a83e7ed.cpressey>