diff options
author | Andrew J. Schorr <aschorr@telemetry-investments.com> | 2016-07-04 10:34:00 -0400 |
---|---|---|
committer | Andrew J. Schorr <aschorr@telemetry-investments.com> | 2016-07-04 10:34:00 -0400 |
commit | b3fa425feb23dd36e82d4dd71f0bc1e03495a46b (patch) | |
tree | 4eb0da682865bc7ca8c01c239e5056442de3ac62 /test/arrayind3.awk | |
parent | ff4e0706c5ee5dffd69168ebd0ff5f53e474d048 (diff) | |
download | egawk-b3fa425feb23dd36e82d4dd71f0bc1e03495a46b.tar.gz egawk-b3fa425feb23dd36e82d4dd71f0bc1e03495a46b.tar.bz2 egawk-b3fa425feb23dd36e82d4dd71f0bc1e03495a46b.zip |
It is OK to use a strnum as a string array subscript, since we now respect the string value.
Diffstat (limited to 'test/arrayind3.awk')
-rw-r--r-- | test/arrayind3.awk | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/arrayind3.awk b/test/arrayind3.awk new file mode 100644 index 00000000..ca4c58b5 --- /dev/null +++ b/test/arrayind3.awk @@ -0,0 +1,19 @@ +BEGIN { + # initialize cint arrays + pos[0] = 0 + posout[0] = 0 + split("00000779770060", f) # f[1] is a strnum + pos[f[1]] = 1 # subscripts must be strings! + for (x in pos) { + # if x is a strnum, then the + # x != 0 test may convert it to an integral NUMBER, + # and we might lose the unusual string representation + # if the cint code is not careful to recognize that this is + # actually a string + if (x != 0) + posout[x] = pos[x] + } + # which array element is populated? + print posout[779770060] + print posout["00000779770060"] +} |