🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.bugs.sys5
Article #684

Re: awk bug

#684
From: Brandon Allbery
Date: Sat, 13 Feb 1988 01:17
21 lines
1778 bytes
As quoted from <2161@ttrdc.UUCP> by levy@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."
Technical Details
Message-ID: <7224@ncoast.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!water!watmath!clyde!cbosgd!mandrill!hal!ncoast!allbery
References: <672@pttesac.UUCP> <3748@megaron.arizona.edu> <2161@ttrdc.UUCP>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!water!watmath!clyde!cbosgd!mandrill!hal!ncoast!allbery
From: allbery@ncoast.UUCP (Brandon Allbery)
Newsgroups: comp.bugs.sys5
Subject: Re: awk bug
Message-ID: <7224@ncoast.UUCP>
Date: 13 Feb 88 01:17:28 GMT
References: <672@pttesac.UUCP> <3748@megaron.arizona.edu> <2161@ttrdc.UUCP>
Reply-To: allbery@ncoast.UUCP (Brandon Allbery)
Followup-To: comp.bugs.sys5
Organization: Cleveland Public Access UN*X, Cleveland, Oh
Lines: 21