2 ms·
There are a number of old-school C programs that follow a familiar template: they're invoked on the command line, run from top to bottom, and exit. For those,
by samatman 7y ago
There are a number of old-school C programs that follow a familiar template: they're invoked on the command line, run from top to bottom, and exit.
For those, it's often the case that they allocate-only, and have a cleanup block for resources like file handles which must be cleaned up; any error longjmps there, and it runs at the end under normal circumstances.
This is basically using the operating system as the garbage collector, and it works fine.