bug-gnu-utils
[Top][All Lists]
Advanced

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

Re: index("","")


From: Aharon Robbins
Subject: Re: index("","")
Date: Sun, 24 Aug 2003 16:33:54 +0300

Greetings. Re this:

> Date: Fri, 22 Aug 2003 10:23:11 -0700
> From: W M Brelsford <address@hidden>
> To: address@hidden
> Subject: index("","")
>
> Up through gawk-3.1.0, the value of
>
>       index("","")
>       
> (or, more usefully, "index($0,$1)" with a null input line) was 0.
> In 3.1.1, and still in 3.1.3, it evaluates to 1.
>
> Is this a bug or a change in definition?  I assume a bug, since the
> string doesn't have a position 1.
>
> Thanks,
>
> -- 
> Bill Brelsford
> address@hidden

It is a change in definition. The null string does occur in the
null string, at the earliest possible point, i.e. position 1. This is
noted in the NEWS file; it happened for 3.1.1.  I made this change
because both Bell Labs awk and mawk work that way.

Arnold




reply via email to

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