HP3000-L Archives

December 2001, Week 4

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Stan Sieler <[log in to unmask]>
Reply To:
Stan Sieler <[log in to unmask]>
Date:
Thu, 27 Dec 2001 14:25:29 -0500
Content-Type:
text/plain
Parts/Attachments:
text/plain (37 lines)
You're both partially right :)

Having code (at a single-point of termination) to close/cleanup things
is good.

But....one should NEVER unconditionally close files or databases...
such code should always check if they're *open*.

E.g.:

   if base'is'open then
      dbclose (...);
      if status = 0 then
         base'is'open := false;

or

   if fid > 0 then
      fclose (fid, 0, 0);
      if = then
         fid := 0;

Thus, we get both Bruce's desire (cleanup) and Steve's (no blind calls
to DBCLOSE (or FCLOSE)).

I always do the "fid := 0" or "base'is'open := false", even if the
next line of code is:  terminate;

Why?  Someday, someone might add code inbetwee the two ... code that
calls a routine that wants to use the file (or database) if it's open :)

Happy New Year,
Stan

* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *

ATOM RSS1 RSS2