Path: csiph.com!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: standard error codes Date: Mon, 09 Jan 2017 09:06:36 -0800 Organization: None to speak of Lines: 25 Message-ID: References: <96e16709-18eb-4399-86c4-a6f30a767df3@googlegroups.com> <212f08fd-b09e-4848-8485-f7480eaaae45@googlegroups.com> <86260b21-0fa2-42b4-93c6-08e9241d4c17@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: mx02.eternal-september.org; posting-host="6c721cfaf93ed32af64f281370ab6cae"; logging-data="27300"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18UQLqZ9+BvXgAazMsCGtEl" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:7T/OxzPGCUgE4zUU8kBlzwn9vmc= sha1:jWJ5xXg9I2QjOiPww6YCyj4NF3o= Xref: csiph.com comp.lang.c:101344 Malcolm McLean writes: [...] > 0 for success, -1 for fail is one of the standard conventions. I think 0 for success, 1 for failure is more common. Or 0 for success, non-0 for failure. > My view is that a normal function (not a built-in mathematical > function like sin or cos, but a standard user function like > getCandidateCornerPixels() should be the only thing on the > line, together with it's return assignment if appropriate. > > Otherwise code becomes to hard to read. if for success which > is almost always taken also introduces a level of nesting. The > rule of three says keep nesting to three levels, so they are > too precious to waste like that.\ Fortunately for the rest of us, the "rule of three" exists only in your mind. -- Keith Thompson (The_Other_Keith) kst-u@mib.org Working, but not speaking, for JetHead Development, Inc. "We must do something. This is something. Therefore, we must do this." -- Antony Jay and Jonathan Lynn, "Yes Minister"