[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug-gawk] Bug: invalid evaluation of variable in for statement
From: |
Aharon Robbins |
Subject: |
Re: [bug-gawk] Bug: invalid evaluation of variable in for statement |
Date: |
Wed, 03 Feb 2016 23:06:18 +0200 |
User-agent: |
Heirloom mailx 12.5 6/20/10 |
Hi.
Thank you for using gawk and for taking the time to send in a report.
> I'm saying awk has very loose (think no) typing. Every variable is either
> (both and, not either or) a string or a number, and the only way you can be
> certain the correct form of comparison is used is by turning the variable
> into an expression as part of the comparison:
That is generally correct. The manual (not the man page) documents things
pretty well.
I also think Andy's analysis is correct and that your program should
have the `+ 0' to force the numeric comparison.
Different awks do different things with your program. Mawk acts like
gawk 4, where as Brian Kernighan's awk acts like gawk 3.1 did.
I happen to think that gawk 4 and mawk are correct and that
you effectively found a bug in gawk 3.1. :-)
FWIW, the current version is 4.1.3; you should upgrade to that in
any case as there is more functionality and a number of bug fixes.
Thanks,
Arnold