From: Zoltan Hidvegi <hzoli@cs.elte.hu>
To: rft@cg.tuwien.ac.at
Cc: zsh-workers@math.gatech.edu
Subject: Re: local variable setting problem/bug
Date: Wed, 20 Nov 1996 02:41:57 +0100 (MET) [thread overview]
Message-ID: <199611200141.CAA00871@hzoli.ppp.cs.elte.hu> (raw)
In-Reply-To: <9611192131.AA25535@raven.cg.tuwien.ac.at> from Robert F Tobler at "Nov 19, 96 10:31:39 pm"
> But even worse than that, try the following function:
>
> bug()
> {
> local a=()
> local b
> local c
> }
>
> On Nextstep 3.3 running zsh 3.00 or zsh 3.01 (with -f option) I get:
> zsh: 24224 segmentation fault zsh -f
>
> On Linux 1.3.52 running zsh 2.6-beta13 I get (after a while):
> zsh: fatal error: out of memory
>
> And on Irix 5.2 running zsh 3.00 it also consumes memory and
> won't terminate normally.
That's not surprising since local a=() in fact defined a function local and
a function a= which executed local b. So the function called local
recursively calls itself and there is not exit from this recursion. You
probably wanted to use it as
bug() {
local a
a=()
...
}
You cannot initialise local variables with an array at declaration. You
must use a separate assignment for that.
Zoltan
next prev parent reply other threads:[~1996-11-20 2:01 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
1996-11-19 21:31 Robert F Tobler
1996-11-20 1:41 ` Zoltan Hidvegi [this message]
1996-11-20 2:02 ` Hrvoje Niksic
1996-11-20 15:33 ` Zoltan Hidvegi
1996-11-20 19:32 ` Hrvoje Niksic
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=199611200141.CAA00871@hzoli.ppp.cs.elte.hu \
--to=hzoli@cs.elte.hu \
--cc=rft@cg.tuwien.ac.at \
--cc=zsh-workers@math.gatech.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).