svn commit: r368714 - head/lib/libc/string

Steffen Nurpmeso steffen at sdaoden.eu
Sat Dec 19 13:52:28 UTC 2020


Kevin Bowling wrote in
 <CAK7dMtBP4L42-o01ohLoPdsRFV6yAiLjKREtDo_KL1ACWvA9qA at mail.gmail.com>:
 |On Thu, Dec 17, 2020 at 9:33 AM Ian Lepore <ian at freebsd.org> wrote:
 |> On Thu, 2020-12-17 at 18:22 +0200, Konstantin Belousov wrote:
 |>> On Thu, Dec 17, 2020 at 01:01:01PM +0000, Jessica Clarke wrote:
 |>>> On 17 Dec 2020, at 12:53, Konstantin Belousov <kostikbel at gmail.com>
 |>>> wrote:
 |>>>> On Thu, Dec 17, 2020 at 12:41:47PM +0000, Mateusz Piotrowski
 |>>>> wrote:
 |>>>>> Author: 0mp (doc,ports committer)
 |>>>>> Date: Thu Dec 17 12:41:47 2020
 |>>>>> New Revision: 368714
 |>>>>> URL: https://svnweb.freebsd.org/changeset/base/368714
 ...
 |>>>>> +       return (0);
 |>>>>
 |>>>> return (0) is redundand.
 ...
 |>> Why it is bad practice ?
 |>>
 |>> C is a small language, and while knowing some quirks (like this one)
 |>> seems to be optional, others are not. And worse, that other quirks are
 ...
 |> How obscure is this quirk?  I've been writing C code since 1983,
 |> including having released a freeware compiler (pre-gcc days) and
 |> working on a commercial C compiler.  I used to moderate the c_language
 |> conference on BIX (back when that was a thing).  I make my living
 |> writing C and C++ code every day.  And yet, I had completely forgotten
 |> about this quirk.
 ...
 |In Kib’s defense I think this is commonly mentioned in C99 books (at least
 |that’s where I learned of it) so it depends on when and where someone
 |learned.  There are merits approaches of being explicit or brief.  I have

Nicely said.  K&R C 2nd Ed. explicitly uses return(0) many times.

--steffen
|
|Der Kragenbaer,                The moon bear,
|der holt sich munter           he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


More information about the svn-src-head mailing list