bug-gawk
[Top][All Lists]
Advanced

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

Re: lint warning: operator `+' used on two string values


From: Hermann Peifer
Subject: Re: lint warning: operator `+' used on two string values
Date: Mon, 9 Oct 2023 09:32:36 +0200
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.15.1

Your patch works fine, as expected. Thanks the quick fix. Hermann

On 08/10/2023 21.09, arnold@skeeve.com wrote:
Hi.

Yet another good catch. Patch is attached. I'll be pushing
to Git shortly.

Thanks,

Arnold

Hermann Peifer <peifer@gmx.eu> wrote:

On 07/10/2023 12.56, Hermann Peifer wrote:
Hi again.

I am wondering if it is a feature or rather a bug that the lint warning
is also thrown in the second example below.

Regards, Hermann

# Adding 2 values of type: string
  > echo a b | ./gawk --lint '{print $1 + $2, typeof($1), typeof($2)}'
gawk: cmd. line:1: warning: `typeof' is a gawk extension
gawk: cmd. line:1: (FILENAME=- FNR=1) warning: operator `+' used on two
string values
0 string string


# Adding 2 values of type: strnum
  > echo 1 2 | ./gawk --lint '{print $1 + $2, typeof($1), typeof($2)}'
gawk: cmd. line:1: warning: `typeof' is a gawk extension
gawk: cmd. line:1: (FILENAME=- FNR=1) warning: operator `+' used on two
string values
3 strnum strnum

(...)
Just to add a 3rd example where the lint warning is gone after moving
"$1 + $2" to the end of the print statement.

  > echo 1 2 | ./gawk --lint '{print typeof($1), typeof($2), $1 + $2}'
gawk: cmd. line:1: warning: `typeof' is a gawk extension
strnum strnum 3




reply via email to

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