E
Eric Sosman
Richard said:jacob navia said:
I have already given an example, upthread, of what you call a "transient"
program which became a "non-transient" program five years later. Skimp on
the housekeeping now, and pay for it many times over in the future.
Engineering is about balancing considerations that are
sometimes in conflict. No one consideration or goal is always
paramount. Besides, even when "The program must be easy to
modify" is important, the designer faces the challenge of
trying to anticipate the likely modifications. Sometimes
the crystal ball works, sometimes it's cloudy, and hindsight
is always twenty-twenty.
No matter how many times you repeat an incorrect argument, it remains
incorrect.
"Incorrect" is too absolute a term to apply here. Can
you think of a good reason for the Unix `shutdown' program
to free() its allocated memory before returning? Yes, a
leaky `shutdown' would be hard to use in a loop, but ...
For what it's worth, many of my own programs follow the
general line Jacob describes, at least in part. "Library"
or "utility" functions are scrupulous about their memory
bookkeeping because they don't know the context they run in;
they're careful about memory for the same reasons they don't
call abort(). But if there's a bunch of long-lived data
that represents the program's "global state," I see nothing
wrong with letting exit() clean it up.