Subject: | |
From: | |
Reply To: | |
Date: | Thu, 27 Dec 2001 14:25:29 -0500 |
Content-Type: | text/plain |
Parts/Attachments: |
|
|
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 *
|
|
|