awk bug

Brandon Allbery allbery at ncoast.UUCP
Sat Feb 13 11:17:28 AEST 1988


As quoted from <2161 at ttrdc.UUCP> by levy at ttrdc.UUCP (Daniel R. Levy):
+---------------
| I would posit that, just as when programming in C, testing a field without
| first knowing that it is valid (the field count is high enough) is poor
| programming practice.  I will eat these words if someone can show me awk
| documentation that says that an undefined positional parameter is guaranteed
| to be null/0 just as an undefined member of an array or previously unused
| variable is guaranteed to be.  (I've written many a line of awk code using
+---------------

The bible ("Awk - A Pattern Scanning and Processing Language") doesn't say
anything one way or the other.  On the other hand, the awk guide which came
with my 3B1 says:  "If NF < i <= 100, then $i behaves like an uninitialized
var."  I would say that the issue is open -- but the behavior on the 3B20 is
still wrong:  it should either return a null string or cause an error, it
should NOT return "f{" or anything like that.  After all, given this behavior
if I try it on ncoast awk will dump core (address 0 isn't mapped).
-- 
	      Brandon S. Allbery, moderator of comp.sources.misc
       {well!hoptoad,uunet!hnsurg3,cbosgd,sun!mandrill}!ncoast!allbery
KABOOM!!! Worf: "I think I'm sick." LaForge: "I'm sure half the ship knows it."



More information about the Comp.bugs.sys5 mailing list