[Bug 257288] awk - loop over array index goes in reverse

From: <bugzilla-noreply_at_freebsd.org>
Date: Tue, 20 Jul 2021 01:23:05 +0000
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=257288

Warner Losh <imp_at_FreeBSD.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|New                         |Open

--- Comment #2 from Warner Losh <imp_at_FreeBSD.org> ---
>From the gawk manual on the for (i in array) construct:

"The order in which elements of the array are accessed by this statement is
determined by the internal arrangement of the array elements within awk and in
standard awk cannot be controlled or changed. This can lead to problems if new
elements are added to array by statements in the loop body; it is not
predictable whether the for loop will reach them. Similarly, changing var
inside the loop may produce strange results. It is best to avoid such things."

So I think this is a "not a bug" situation. I'll let the originator offer a
dissenting view before closing, however.

-- 
You are receiving this mail because:
You are the assignee for the bug.
Received on Tue Jul 20 2021 - 01:23:05 UTC

Original text of this message