Path: ...!eternal-september.org!feeder2.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Pancho Newsgroups: comp.os.linux.misc Subject: Re: Joy of this, Joy of that Date: Sat, 23 Nov 2024 09:10:01 +0000 Organization: A noiseless patient Spider Lines: 30 Message-ID: References: <6iKdnTQOKNh6AqD6nZ2dnZfqn_idnZ2d@earthlink.com> <20241120081039.00006d2a@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Sat, 23 Nov 2024 10:10:02 +0100 (CET) Injection-Info: dont-email.me; posting-host="0996b149b2c257ae77a172fc1c1f1afd"; logging-data="1715372"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/3FC9YLdIFg9kNOkzqpwDL57pEXc3dxWg=" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:2I8xBEGMT4y+OK00Bb/jxEWUMvE= Content-Language: en-GB In-Reply-To: Bytes: 2400 On 11/23/24 07:09, Charlie Gibbs wrote: > On 2024-11-22, Lawrence D'Oliveiro wrote: > >> On Fri, 22 Nov 2024 18:53:28 GMT, Charlie Gibbs wrote: >> >>> All my programs contain a routine called quit_cleanup(); it takes a >>> single argument, which is either an error message or NULL. >>> It frees all allocated memory, closes any open files, etc. >> >> But all that is unnecessary if your program is terminating anyway. >> >> In *nix C code, a common convention is >> >> if («call failed») >> { >> perror(«doing what»); >> exit(«nonzero error code»); >> } /*if*/ >> >> > > Perhaps, but I'm a belt-and-suspenders guy - I like > to explicitly free everything come hell or high water. > I can see that is nice, to understand what you have, but it sounds like hard work. However there are some resource you do need to explicitly free/release/close, some database locks for instance.