3 ms·
This author must have buried their head in the sand before C++ destructors. The need to have an opposite function to constructing a new object isn't coming fro
by kazinator 4y ago
This author must have buried their head in the sand before C++ destructors.
The need to have an opposite function to constructing a new object isn't coming from malloc; it's a resource management problem. fclose(f) doesn't just free FILE *f; it releases some operating system file handle/descriptor, and also removes the object from some global list. (There is one because fflusn(NULL) or process termination is somehow able to flush all streams.)