[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: gawk bug

From: Paul Eggert
Subject: Re: gawk bug
Date: Sun, 30 Sep 2001 08:08:29 -0700 (PDT)

> From: Doug McIlroy <address@hidden>
> Date: Sat, 29 Sep 2001 17:15:57 -0400
> This gawk program produces no output for any input
>       gawk '{print $1>0}'
> but this one does
>       gawk '{print ($1>0)}'
> I am running gawk version 3.0.6

I have never run into that awk syntax glitch, because I try to follow
some good advice that I learned long ago from D. Val Schorre
(whom Knuth credits with the first to propose goto-less programming).
Here's the advice:

  Use <, not >.
  (Similarly for <= and >=.)

It may sound silly at first, but it really does make code a bit more
readable if textual order reflects semantic order.

I think the awk problem doesn't occur with '<', so that's another bonus
of avoiding '>'.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]