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: arnold
Subject: Re: lint warning: operator `+' used on two string values
Date: Sun, 08 Oct 2023 13:09:01 -0600
User-agent: Heirloom mailx 12.5 7/5/10

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
>

Attachment: lintplus-fix.diff
Description: Text document


reply via email to

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