Groups | Search | Server Info | Login | Register


Groups > comp.lang.pascal.ansi-iso > #1

Linearizeing nested IFs

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!goblin2!goblin.stu.neva.ru!feeder.erje.net!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail
From Anton Shepelev <anton.txt@gmail.com>
Newsgroups comp.lang.pascal.ansi-iso
Subject Linearizeing nested IFs
Date Mon, 4 Apr 2011 15:52:47 +0400
Organization A noiseless patient Spider
Lines 25
Message-ID <20110404155247.54855e59.anton.txt@gmail.com> (permalink)
Mime-Version 1.0
Content-Type text/plain; charset=US-ASCII
Content-Transfer-Encoding 7bit
Injection-Info mx02.eternal-september.org; posting-host="ZfywcaqSRqI7F26hrH6qlA"; logging-data="24998"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+eWfKuWPG80xFCD5+FNF8+5ww16CIkFj4="
X-Newsreader Sylpheed 3.1.0 (GTK+ 2.10.14; i686-pc-mingw32)
Cancel-Lock sha1:UGhsqIZ7H/LaEgpkinYn9mJc8T0=
Xref x330-a1.tempe.blueboxinc.net comp.lang.pascal.ansi-iso:1

Show key headers only | View raw


Hello all,

The   standard  Pascal  (ISO 7185)  doesn't  have  a
'return' statement, so a function or procedure  will
execute  to the end. I often encounter situations in
which multiple sequential checks  must  be  done  so
that:

  a.  the  failure of one check interrupts the whole
      sequence and

  b.  each seccessive check may use the result  cal-
      culated in the previous check.

This  can  be represented like many nested IF state-
ments, which is ugly when the nesting level is high.
Languages  with  a non-structured 'return' statement
allow to linearize this, but what to do in Pascal?

I thought about looping through an array of fucntion
pointers,  but this seems too much of an overhead to
me...

Thank you in advance,
Anton

Back to comp.lang.pascal.ansi-iso | NextNext in thread | Find similar


Thread

Linearizeing nested IFs Anton Shepelev <anton.txt@gmail.com> - 2011-04-04 15:52 +0400
  Re: Linearizeing nested IFs Marco van de Voort <marcov@turtle.stack.nl> - 2011-04-04 12:12 +0000
  Re: Linearizeing nested IFs "Chris Burrows" <cfbsoftware@hotmail.com> - 2011-04-05 07:50 +0930
  Re: Linearizeing nested IFs Anton Shepelev <anton.txt@gmail.com> - 2011-04-06 13:04 +0400
  Re: Linearizeing nested IFs stuart <sking@irietools.com> - 2011-04-13 14:44 -0700
    Re: Linearizeing nested IFs Anton Shepelev <anton.txt@gmail.com> - 2011-04-23 23:39 +0400

csiph-web