bug-gawk
[Top][All Lists]
Advanced

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

Re: is my loop issue a data conversion bug?


From: Wolfgang Laun
Subject: Re: is my loop issue a data conversion bug?
Date: Mon, 13 Jul 2020 22:03:31 +0200

In (g)awk, the type of an array index is string. Even if you use an integer
expression to create an array element, internally the array index is a
string. Iterating over the index values ("x in ary") yields string values.
-W

On Mon, 13 Jul 2020 at 20:42, Peter Lindgren <ogswd-awk@yahoo.com> wrote:

> I hesitate to report this as a bug - maybe it's just some expected
> behavior I don't understand ("That's not a bug, its a feature!"). But here
> goes anyway...
>
> The gist is that I have two nested loops, each of which - only under very
> particular circumstances - roams beyond its bounds. The attached awk
> programs are hacked down to just the necessary skeletons, from a real
> program of mine, actually the one that I was profiling recently and which
> ran so long on large inputs that I had to ask for 64-bit profiling counts.
>
> One called "lendemobad.awk" gives the bad or unexpected results , one
> called "lendemo.awk" gives the expected results. You can diff them to see
> how minimal the changes are - simply forcing the variable being used as the
> loop limit to numeric seems to fix things.
>
> Run them both on the supplied test data file "lendemo.dat" and observe the
> differences in the outputs. There are comments in the programs highlighting
> the interesting bits.
>
> Note: if you have any other email addresses for me, please reply only to
> this one starting "og..."
>
> Regards,
> Peter
>
>


reply via email to

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