[Top][All Lists]

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

RE: GAWK does not like "default" as an argument name

From: Nielsen, Dan \(GE, Corporate\)
Subject: RE: GAWK does not like "default" as an argument name
Date: Mon, 31 Jul 2006 17:14:56 -0400


Thanks all for the insight and clarification. I'm still a newbie to awk, only 
having worked with it since 1992, and obviously  still learning. 

I did check "GAWK: Effective AWK Programming" dated June 2005 and no mention of 
"default" was listed in the list of keywords. I quote, "gawk's keywords are: 
BEGIN, END, if, else, while, do...while, for, for...in, break, continue, 
delete, next, nextfile, function, func, and exit." Perhaps the next edition 
could mention "default" as being reserved along with "switch" and "case" when 
gawk is configured with the --enable-switch. I know one can assume these to be 
keywords by reading page 302 of the manual but most people, myself included, 
would just search the PDF file for "keywords" and go no further.

Anyway, thanks for all the time and effort you put into awk -- my favorite 


Dan Nielsen
GE Corporate
Old Albany Post Road
Ossining NY 10562
T 914-944-1725
E mailto:address@hidden

-----Original Message-----
From: Aharon Robbins [mailto:address@hidden
Sent: Monday, July 31, 2006 15:06
To: address@hidden; address@hidden
Cc: address@hidden; Nielsen, Dan (GE, Corporate)
Subject: Re: GAWK does not like "default" as an argument name

Andy's right; default is only a reserved word if gawk was configured
with the --enable-switch configure option.  It looks like Mr. Nielsen's
copy was built that way.


> Date: Mon, 31 Jul 2006 10:50:53 -0400
> From: "Andrew J. Schorr" <address@hidden>
> Subject: Re: GAWK does not like "default" as an argument name
> To: Paul Jarc <address@hidden>
> Cc: "Nielsen, Dan (GE, Corporate)" <address@hidden>, address@hidden
> On Sun, Jul 30, 2006 at 11:58:53PM -0400, Paul Jarc wrote:
> > "Nielsen, Dan \(GE, Corporate\)" <address@hidden> wrote:
> > > # ZERROR7.AWK - GAWK doesn't like "default" in argument list
> > > # Change "default" to "Default" or "_default" and it works fine.
> > > # How to run: GAWK -f C:\AWK\ZERROR7.AWK
> > > BEGIN { x() }
> > > function x(default) { printf("ok") }
> > 
> > "default" is a keyword of the language, like "function" or "if".
> > Keywords can't be used as identifiers.
> I think "default" should be a keyword only if gawk was built
> with 'configure --enable-switch'.  My tests here confirm that your
> script should work fine if the "switch" statement is not enabled.
> Does that correspond with your experience?
> Regards,
> Andy

reply via email to

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