Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why is alength() instead of length() used? #10

Open
prRZ5F4LXZ opened this issue Jul 1, 2021 · 1 comment
Open

Why is alength() instead of length() used? #10

prRZ5F4LXZ opened this issue Jul 1, 2021 · 1 comment

Comments

@prRZ5F4LXZ
Copy link

prRZ5F4LXZ commented Jul 1, 2021

I see awka uses alength() instead of length(). But other awk implementation support length(). Is it better to rename alength() to length() so that awk code works with other awk implementations still works with awka?

$ awka 'BEGIN { a["a"]=1; print alength(a) }' > a.c
$ gcc -lawka -o a.out a.c
$ ./a.out
$  awka 'BEGIN { a["a"]=1; print length(a) }'
awka: line 1: illegal reference to array a
$ mawk 'BEGIN { a["a"]=1; print length(a) }'
1
$ gawk 'BEGIN { a["a"]=1; print length(a) }'
1
@prRZ5F4LXZ prRZ5F4LXZ changed the title Why length() does not work? Why is alength instead of length() used? Jul 1, 2021
@prRZ5F4LXZ prRZ5F4LXZ changed the title Why is alength instead of length() used? Why is alength() instead of length() used? Jul 1, 2021
@jlp765
Copy link

jlp765 commented Jul 18, 2021

Fixed in #12

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants