aboutsummaryrefslogtreecommitdiffstats
path: root/doc/gawk.texi
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2021-10-09 21:17:25 +0300
committerArnold D. Robbins <arnold@skeeve.com>2021-10-09 21:17:25 +0300
commitb09f86a66cc6cae015a1343c189c84031007de1c (patch)
treed1385c574c38d9525c84e47a3f0933d0d90e0499 /doc/gawk.texi
parent6bb7dd16b9af1569ab57e95024e6ad6745875f83 (diff)
parentf1819adeb27379fd0199662b3daffcac4132e5b0 (diff)
downloadegawk-b09f86a66cc6cae015a1343c189c84031007de1c.tar.gz
egawk-b09f86a66cc6cae015a1343c189c84031007de1c.tar.bz2
egawk-b09f86a66cc6cae015a1343c189c84031007de1c.zip
Merge branch 'gawk-5.1-stable'
Diffstat (limited to 'doc/gawk.texi')
-rw-r--r--doc/gawk.texi50
1 files changed, 33 insertions, 17 deletions
diff --git a/doc/gawk.texi b/doc/gawk.texi
index 7bb56906..142708eb 100644
--- a/doc/gawk.texi
+++ b/doc/gawk.texi
@@ -15317,20 +15317,25 @@ awk '
This prints the first three fields of each input record, with one
input field per output line.
-It isn't possible to
-set more than one variable in the
-@var{initialization} part without using a multiple assignment statement
-such as @samp{x = y = 0}. This makes sense only if all the initial values
-are equal. (But it is possible to initialize additional variables by writing
-their assignments as separate statements preceding the @code{for} loop.)
-
@c @cindex comma operator, not supported
-The same is true of the @var{increment} part. Incrementing additional
-variables requires separate statements at the end of the loop.
-The C compound expression, using C's comma operator, is useful in
-this context, but it is not supported in @command{awk}.
+C and C++ programmers might expect to be able to use the comma
+operator to set more than one variable in the @var{initialization}
+part of the @code{for} loop, or to increment multiple variables in the
+@var{incrememnt} part of the loop, like so:
+
+@example
+for (i = 0, j = length(a); i < j; i++, j--) @dots{} @ii{C/C++, not awk!}
+@end example
+
+@noindent
+You cannot do this; the comma operator is not supported in @command{awk}.
+There are workarounds, but they are nonobvious and can lead to
+code that is difficult to read and understand. It is best, therefore,
+to simply write additional initializations as separate statements
+preceding the @code{for} loop and to place additional increment statements
+at the end of the loop's body.
-Most often, @var{increment} is an increment expression, as in the previous
+Most often, @var{increment} is an increment expression, as in the earlier
example. But this is not required; it can be any expression
whatsoever. For example, the following statement prints all the powers of two
between 1 and 100:
@@ -43280,7 +43285,7 @@ The following things are @emph{not} bugs, and should not be reported
to the bug mailing list. You can ask about them on the ``help'' mailing
list (@pxref{Asking for help}), but don't be surprised if you get an
answer of the form ``that's how @command{gawk} behaves and it isn't
-going to change.''
+going to change.'' Here's the list:
@itemize @bullet
@item
@@ -43290,6 +43295,8 @@ fields or records, or anything else.
The number of features that @command{gawk} does @emph{not} have is
by definition infinite. It cannot be all things to all people.
+In short, just because @command{gawk} doesn't do what @emph{you}
+think it should, it's not necessarily a bug.
@item
Behaviors that are defined by the POSIX standard and/or for historical
@@ -43303,10 +43310,16 @@ and @command{gawk} stand on their own and do not have to follow the crowd.
This is particularly true when the requested behavior change would break
backwards compatibility.
+This applies also to differences in behavior between @command{gawk}
+and other language compilers and interpreters, such as wishes for more
+detailed descriptions of what the problem is when a syntax error is
+encountered.
+
@item
Documentation issues of the form ``the manual doesn't tell me how to
do XYZ.'' The manual is not a cookbook to solve every little problem
-you may have.
+you may have. Its purpose is to teach you how to solve your problems
+on your own.
@item
General questions and discussion about @command{awk} programming or
@@ -43335,7 +43348,7 @@ time and ours.
@item
Verify that you have the latest version of @command{gawk}.
Many bugs (usually subtle ones) are fixed at each release, and if yours
-is out of date, the problem may already have been solved.
+is out-of-date, the problem may already have been solved.
@item
Please see if setting the environment variable @env{LC_ALL}
@@ -43441,6 +43454,10 @@ Usenet/Internet newsgroup @code{comp.lang.awk}. Although some of the
@command{gawk} maintainer no longer does. Thus it's virtually guaranteed
that he will @emph{not} see your posting.
+If you really don't care about the previous paragraph and continue to
+post bug reports in @code{comp.lang.awk}, then understand that you're
+not reporting bugs, you're just whining.
+
Similarly, posting bug reports or questions in web forums (such
as @uref{https://stackoverflow.com/, Stack Overflow}) may get you
an answer, but it won't be from the @command{gawk} maintainers,
@@ -43565,7 +43582,7 @@ After two such requests you will be silently @emph{blacklisted} from the bug lis
Please note: As with the bug list, we ask that you follow the
@uref{https://gnu.org/philosophy/kind-communication.html,
-GNU Kind Communication Guidelines} in your correspondence on the
+GNU Kind Communication Guidelines} in your correspondence on the help
list (as well as off of it).
@cindex Proulx, Bob
@@ -43573,7 +43590,6 @@ If you wish to the subscribe to the list, in order to help out
others, or to learn from others, here are instructions, courtesy
of Bob Proulx:
-
@table @emph
@item Subscribe by email