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

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

side effects of split() parameter


From: Stepan Kasal
Subject: side effects of split() parameter
Date: Mon, 13 May 2002 16:17:58 +0200
User-agent: Mutt/1.2.5.1i

Hallo Aharon,
        I've found the following bug:

$ awk 'BEGIN{s="";a[1]=7;split("",b,split("",a));print a[1]}'
7

Patch is attached.

The bug also appears in sub/gsub/gensub, but the patch doesn't cover this
since I'm trying to rewrite sub_common in a more transparent way and I'm
going to offer you the result in a few days.

Do you know about other builtins which may also discard a parameter without
evaluating it?

I have an idea that during compile time, the nodes are marked by a SIDEEFF
bit (SIDEEFF==0 implies there are surely no side effects).
The bit is defined by an intuitive recursive definition.
This would for example avoid evaluation of the parameter if it's just an
expensive concatenation.
But I won't have time for this any time soon, I'm afraid.

Stepan Kasal

Attachment: gawk-3.1.1-split_sideeff.patch
Description: Text document


reply via email to

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