Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.sys.acorn.programmer > #526
| From | "Ste (news)" <steve@revi11.plus.com> |
|---|---|
| Subject | Re: Task Obey madness |
| Newsgroups | comp.sys.acorn.programmer |
| Date | 2011-07-07 13:55 +0100 |
| Message-ID | <51ef10e8c6steve@revi11.plus.com> (permalink) |
| References | (2 earlier) <51ede3e23cUCEbin@tiscali.co.uk> <iuugf2$u4e$1@dont-email.me> <51edf0d282Paul@sprie.nl> <4e13fd7a$0$30774$ba4acef3@reader.news.orange.fr> <97b8a439-e653-4c26-abe2-b759d2760fc0@r2g2000vbj.googlegroups.com> |
| Organization | None |
In article
<97b8a439-e653-4c26-abe2-b759d2760fc0@r2g2000vbj.googlegroups.com>,
jgharston <jgh@arcade.demon.co.uk> wrote:
> Rick Murray wrote:
> > >> IF handle%<>0 THEN htemp%=handle%:handle%=0:CLOSE#htemp%
> > >> ...is better than:
> > >> IF handle%<>0 THEN CLOSE#handle%:handle%=0
> > > why exactly is that better?
> >
> > No idea. It seems excessive to me.
>
> Consider what happens if the CLOSE# causes an error
There are two reasons why you might not want to do that:
1. most half-decent BASIC error handlers will look like this:
DEF PROCerror
ON ERROR OFF
...
ENDPROC
or something like that, so if there's an error when the file is closed, you
won't end up calling the routine to try to close the file again anyway.
2. if the CLOSE# itself returned an error then that _could_ indicate that
some transient event has stopped your close operation from working in which
case there's no harm in keeping the handle in a variable and trying again
later to close the file.
On the whole, it all depends upon whether your program is expecting to keep
running after an error or just tidy up as best it can and then report the
error.
However, clearing the handle variable before attempting the CLOSE# call is
also compelling for other reasons (such as the case where you're attempting
to close the file for normal reasons, rather than because of an error).
So it's horses for courses.
Steve
--
Steve Revill @ Home
Note: All opinions expressed herein are my own.
Back to comp.sys.acorn.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Task Obey madness Martin Bazley <martin.bazley@blueyonder.co.uk> - 2011-07-04 21:44 +0100
Re: Task Obey madness Vince M Hudd <vinceh@softrock.co.uk> - 2011-07-04 22:35 +0100
Re: Task Obey madness "John Williams (News)" <UCEbin@tiscali.co.uk> - 2011-07-05 08:07 +0200
Re: Task Obey madness Rob Davison <nospamthanks@invalid.invalid> - 2011-07-05 19:59 +1200
Re: Task Obey madness Paul Sprangers <Paul@sprie.nl> - 2011-07-05 10:28 +0200
Re: Task Obey madness "John Williams (News)" <UCEbin@tiscali.co.uk> - 2011-07-05 12:08 +0200
Re: Task Obey madness Vince M Hudd <vinceh@softrock.co.uk> - 2011-07-05 11:36 +0100
Re: Task Obey madness Paul Sprangers <Paul@sprie.nl> - 2011-07-05 12:43 +0200
Re: Task Obey madness "John Williams (News)" <UCEbin@tiscali.co.uk> - 2011-07-05 12:51 +0200
Re: Task Obey madness Ian Hamilton <Ian.Hamilton@AAUG.net> - 2011-07-05 12:03 +0100
Re: Task Obey madness "John Williams (News)" <UCEbin@tiscali.co.uk> - 2011-07-05 13:32 +0200
Re: Task Obey madness Vince M Hudd <vinceh@softrock.co.uk> - 2011-07-05 12:57 +0100
Re: Task Obey madness "John Williams (News)" <UCEbin@tiscali.co.uk> - 2011-07-05 14:17 +0200
Re: Task Obey madness Paul Sprangers <Paul@sprie.nl> - 2011-07-05 14:39 +0200
Re: Task Obey madness Vince M Hudd <vinceh@softrock.co.uk> - 2011-07-05 12:22 +0100
Re: Task Obey madness Rob Davison <nospamthanks@invalid.invalid> - 2011-07-06 08:27 +1200
Re: Task Obey madness Rick Murray <heyrickmail-usenet@yahoo.co.uk> - 2011-07-06 08:15 +0200
Re: Task Obey madness jgharston <jgh@arcade.demon.co.uk> - 2011-07-06 18:48 -0700
Re: Task Obey madness "Ste (news)" <steve@revi11.plus.com> - 2011-07-07 13:55 +0100
Re: Task Obey madness Rick Murray <heyrickmail-usenet@yahoo.co.uk> - 2011-07-12 20:07 +0200
Re: Task Obey madness cferris@freeRemoveuk.com.invalid - 2011-07-05 09:09 +0100
Re: Task Obey madness Steve Drain <steve@kappa.me.uk> - 2011-07-05 10:19 +0100
Re: Task Obey madness Martin Bazley <martin.bazley@blueyonder.co.uk> - 2011-07-05 12:40 +0100
Re: Task Obey madness Martin <News03@avisoft.f9.co.uk> - 2011-07-05 16:19 +0100
Re: Task Obey madness Alan Adams <alan@adamshome.org.uk> - 2011-07-05 17:31 +0100
Re: Task Obey madness Ian J Hartley <Ian.Hartley@sky.com> - 2011-07-06 12:35 +0100
Re: Task Obey madness "Ste (news)" <steve@revi11.plus.com> - 2011-07-07 13:57 +0100
Re: Task Obey madness Alan Adams <alan@adamshome.org.uk> - 2011-07-07 21:18 +0100
Re: Task Obey madness Ian J Hartley <Ian.Hartley@sky.com> - 2011-07-13 12:36 +0100
Re: Task Obey madness "Ste (news)" <steve@revi11.plus.com> - 2011-07-14 15:58 +0100
Re: Task Obey madness Ian Hamilton <Ian.Hamilton@AAUG.net> - 2011-07-14 16:10 +0100
Re: Task Obey madness Ian J Hartley <Ian.Hartley@sky.com> - 2011-07-17 12:30 +0100
Re: Task Obey madness "Ste (news)" <steve@revi11.plus.com> - 2011-07-17 14:23 +0100
Re: Task Obey madness Ian J Hartley <Ian.Hartley@sky.com> - 2011-07-17 16:14 +0100
Re: Task Obey madness druck <news@druck.org.uk> - 2011-07-14 19:23 +0100
Re: Task Obey madness Ian J Hartley <Ian.Hartley@sky.com> - 2011-07-17 14:17 +0100
Re: Task Obey madness Jeremy Nicoll - news posts <jn.nntp.scrap007@wingsandbeaks.org.uk> - 2011-07-05 22:15 +0100
Re: Task Obey madness Rainer Schubert <dl6hbo@dl6hbo.inka.de> - 2011-07-08 17:14 +0200
csiph-web