Hi Darin,
On 29 Apr 98, 08:26, you wrote to Auke Reitsma
KS>> Just that I still think that the most obvious way to
KS>> implement fopen() and friends is simply just do a malloc() +
KS>> relevant magic and return the value of the malloc()...
AR>> Well, as far as implementation goes I agree with that.
DM> I disagree - if the implementation doesn't remember all of its
DM> "pointers", how is it supposed to flush their buffers when the
DM> program exits (as the standard seems to say it will)? Closing is
DM> no problem, just close() every possible handle. It's the buffer
DM> that the FILE struct points to that I'm talking about here - if
DM> the RTL has lost track of the struct, how will it be flushed?
So it should NOT loose track of it. Other than returning it it should also
keep it itself somewhere in a (dynamic) array. How else ... ;-)
AR>> It is just too bad that it was not efficient enough in real
AR>> old DOS days. But even then a fopen()ed FILE pointer _still_
AR>> should be deallocated with fclose() ;-)
DM> Right. However, the standard allows for exit() to fclose
DM> everything for you... :-)
There's no reason at all that exit() could not access abovementioned array
and call fclose() on all its valid values.
Greetings from
_____
/_|__| Auke Reitsma, Delft, The Netherlands.
/ | \ --------------------------------------
--- GEcho 1.00
---------------
* Origin: Home by the C (Auke.Reitsma@net.hcc.nl) (2:281/400.20)
|