TIP: Click on subject to list as thread! ANSI
echo: c_echo
to: AUKE REITSMA
from: DARIN MCBRIDE
date: 1998-04-29 08:26:00
subject: free`ing memory

 KS> Just that I still think that the most obvious way to implement
 KS> fopen() and friends is simply just do a malloc() + relevant magic
 KS> and return the value of the malloc()...
 AR> Well, as far as implementation goes I agree with that. 
I disagree - if the implementation doesn't remember all of its "pointers", 
how is it supposed to flush their buffers when the program exits (as the 
standard seems to say it will)?  Closing is no problem, just close() every 
possible handle.  It's the buffer that the FILE struct points to that I'm 
talking about here - if the RTL has lost track of the struct, how will it be 
flushed?
 AR> It is just too bad that it was not efficient enough in real old DOS 
ays.
 AR> But even then a fopen()ed FILE pointer _still_ should 
 AR> be deallocated with fclose() ;-)
Right.  However, the standard allows for exit() to fclose everything for 
you... :-)
---
---------------
* Origin: Tanktalus' Tower BBS (1:250/102)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.