bug-gawk
[Top][All Lists]
Advanced

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

Re: [bug-gawk] typeof() array subscripts


From: Andrew J. Schorr
Subject: Re: [bug-gawk] typeof() array subscripts
Date: Sun, 21 Jun 2015 09:55:19 -0400
User-agent: Mutt/1.5.23 (2014-03-12)

On Sun, Jun 21, 2015 at 01:52:46PM +0200, Hermann Peifer wrote:
> Do I also see it right that typeof()'s "untyped" actually means "untyped
> scalar" whereas the debugger's "untyped variable" is a different animal, as
> it can turn into an array?

That appears to be the case:

bash-4.2$ gawk 'BEGIN {print typeof(x)}'
untyped
bash-4.2$ gawk 'BEGIN {print typeof(x); x[1] = 3; print typeof(x)}'
untyped
gawk: cmd. line:1: fatal: attempt to use scalar `x' as an array

It seems that the act of passing 'x' to typeof is instantiating it
as a scalar.  The act of inspecting it changes the result, unfortunately.

Regards,
Andy



reply via email to

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