Re: pattern for an error
- From: Robert <no@xxxxxx>
- Date: Wed, 28 May 2008 06:35:51 -0500
On Wed, 28 May 2008 02:31:57 -0700 (PDT), mario <mmc_vw1200@xxxxxxxxxxx> wrote:
hi everyone,
i have to redesign a peace of code with a lot of GOTOs
looks like that
start.
perform something
perform something_else
perform anything
perform anything_else
...
.
something.
do_something
if (x>10)
error occurs
go to error
end-if
do_something_else
if (y=z)
error occurs
go to error
end-if
.
error.
write error msg
.
ende.
exit program.
so as u maybe see in any paragraph there are exit conditions when the
program should stop and write error massage
my problem now: is there any style guide or pattern to make that in a
clean way WITHOUT goto because i have to transfair it into an acu code
without goto.
the only way i´m thinking is to give a intern retern key after any
paragraph but code would look very confusing right??
Change 'go to error' into 'perform error' (where error includes exit program), or write an
inline 'exit program returning 1234'. Every program should pass back a return code: 0 for
success, non-zero for error. You can do it by moving the value to 'return-code' or with
the returning clause.
.
- Follow-Ups:
- Re: pattern for an error
- From: mario
- Re: pattern for an error
- References:
- pattern for an error
- From: mario
- pattern for an error
- Prev by Date: Re: Opinions on approach, please...
- Next by Date: Re: pattern for an error
- Previous by thread: pattern for an error
- Next by thread: Re: pattern for an error
- Index(es):
Relevant Pages
|