Groups | Search | Server Info | Login | Register


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

Linearizeing nested IFs

From Anton Shepelev <anton.txt@gmail.com>
Newsgroups comp.lang.pascal.ansi-iso
Subject Linearizeing nested IFs
Date 2011-04-04 15:52 +0400
Organization A noiseless patient Spider
Message-ID <20110404155247.54855e59.anton.txt@gmail.com> (permalink)

Show all headers | 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