[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
gawk manual 'function' discussion improvements
From: |
Dan Jacobson |
Subject: |
gawk manual 'function' discussion improvements |
Date: |
09 Jun 2001 22:55:14 +0800 |
User-agent: |
Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7 |
In the manual, in addition to
---------
Definitions of functions can appear anywhere between the rules of an
`awk' program. Thus, the general form of an `awk' program is extended
to include sequences of rules _and_ user-defined function definitions.
There is no need in `awk' to put the definition of a function before
all uses of the function. This is because `awk' reads the entire
program before starting to execute any of it.
--------
I think it should mention: "and you should forget about putting your
functions in the BEGIN{} statement, where you probably thought they
should go, lest you get cryptic error messages, eg.
awk: cmd. line:1: BEGIN{ func foo() { a = sqrt($1) ; print a }}
awk: cmd. line:1: ^ parse error
nor shall you put functions within any other {} pair, no matter how
shallow the depth of nesting."
Yes, do please mention these common foibles.
By the way, there is an info node
* Function Caveats:: Things to watch out for.
But when we get there, it is entitled
Calling User-defined Functions
which is too far for comfort.
By the way, I figured if I programmed really good, I could use --lint
and get no messages. However no matter if you use ** and ^, you are
still going to get messages. OK, I suppose I should add some of the
other Command Line Options...
By the way, this node is oddly named in light of Linux on PCs:
* PC Installation:: Installing and Compiling `gawk' on MS-DOS
and OS/2
By the way, people looking for the word "debug" don't find much in the
manual. Perhaps add an Info page "Debugging Gawk Programs": can one
use gdb, etc., if not is the only way just to add lots of print
statements, etc.
--
http://www.geocities.com/jidanni Tel886-4-25854780 e-mail:restore .com.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- gawk manual 'function' discussion improvements,
Dan Jacobson <=