FreeBSD Port: qmail-1.03_3

Chris Pressey cpressey at catseye.mine.nu
Tue Jan 25 22:06:32 PST 2005


On Tue, 25 Jan 2005 21:50:53 -0800
Michael Sierchio <ducatista at 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


More information about the freebsd-ports mailing list