Update of bug #67722 (group gforth):

                  Status:                    None => Wont Fix
             Open/Closed:                    Open => Closed

    _______________________________________________________

Follow-up Comment #1:

I don't see how to implement CLOSE-FILE in a way that guarantees that double
CLOSE-FILE is noticed as an error under all circumstances, and that does not
leak resources.  Under any implementation that does not leak the file-id may
be reused, and performing CLOSE-FILE on the file-id of the old file would
close the new file.

Gforth's implementation is based on C's fclose(), which has the same problem
<https://stackoverflow.com/questions/24555980/fclose-a-file-that-is-already-fclose>.
 If file-ids were instead represented as Unix file descriptors, they are
reused after closing, too, and if we build our own allocated data structure
for a file, we still have the problem of either leaking the space for that
data structure, or that closing the file again would lead to a double free.

So, I am sorry, we cannot avoid this problem.  You will have to make sure that
you close every file at most once.


    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?67722>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/

Attachment: signature.asc
Description: PGP signature

Reply via email to