Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp3783291pxb; Mon, 27 Sep 2021 02:25:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwLoaEdxZmtBjgW7LQGxHKW0QFpIy5huT3CEfou1M5XdQJEptOmbWJsbWizDbAECQTIahqC X-Received: by 2002:a17:906:370d:: with SMTP id d13mr2714662ejc.262.1632734708936; Mon, 27 Sep 2021 02:25:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632734708; cv=none; d=google.com; s=arc-20160816; b=K/sVtHCJiNrxVIe34wA5HPTdYWlwg2qjoDOeGix7os+2YCxqKvt2y0u7QdMGyTAZg5 /m+P+AQ5iPyfZwTKPduD3KKwztE2x1f0NugZ1Nf8LVZiNU4qVWUEvDuBE0X8cZuJDYtm m1hk1Yk3Zgjh6nHo2ngkzs7YtuGjqke7fCHsqqXpnU74Rh7BxWjlw3bfJ9klnMg18boQ JIpLzCYfXroe6qSIKmW8z/lQV+6IwuXSgu2bq1m9xQTHBz2Qr++jwlaIXZJJJ4HpItlv jll/wp+qHLcdIhkWMnh/AlKCFuSDl4DaSVQedTOu3B3VXFMC/g1Jm2drWVA//xxXhgfh 4caA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=F9eEjRhtZ67N7FMrBDDwRfEOaRWZZZylOW4ZnbZK3Yc=; b=S6A9mYh9tu0mFKan+RuTae+oDxEnyc02SlgnG8WCPIEIc5b+9OOS78fW18RKw7ENB9 0vyqIQorwrjyhTKMCmppEXXpkjgOFKzcTJKV3q4XzMA9z47gucEArRtb6g6s1zfUDkxK hh16O9KN3FeMrabAc+7oI5iIZ7gl3kMNL4wfgWkJ0126/Vg3kPmNnXJgH20+MQtsHuJD phgHS7XC+c2ohbosJZxHsPH444RVRyf3+v07UzD/Zjvg2Xi3eMWUkiF3qfg2NDOkz47b AL7vLuJK6MX6zTOJNHzuTubg9w2vsIxrhCHt2T0Yvg0Wqj5myRYtjCDmLYUm5t+7CDrG jwzA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i16si7472702ejo.323.2021.09.27.02.24.45; Mon, 27 Sep 2021 02:25:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233655AbhI0JYp (ORCPT + 99 others); Mon, 27 Sep 2021 05:24:45 -0400 Received: from wtarreau.pck.nerim.net ([62.212.114.60]:43035 "EHLO 1wt.eu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233638AbhI0JYo (ORCPT ); Mon, 27 Sep 2021 05:24:44 -0400 Received: (from willy@localhost) by pcw.home.local (8.15.2/8.15.2/Submit) id 18R9Mama021544; Mon, 27 Sep 2021 11:22:36 +0200 Date: Mon, 27 Sep 2021 11:22:36 +0200 From: Willy Tarreau To: David Laight Cc: "'Linus Torvalds'" , Alexey Dobriyan , Linux Kernel Mailing List , Joe Perches , Andrew Morton , "apw@canonical.com" , Christoph Lameter , Daniel Micay , Dennis Zhou , "dwaipayanray1@gmail.com" , Joonsoo Kim , Linux-MM , Lukas Bulwahn , "mm-commits@vger.kernel.org" , Nathan Chancellor , Nick Desaulniers , Miguel Ojeda , Pekka Enberg , David Rientjes , Tejun Heo , Vlastimil Babka , "open list:DOCUMENTATION" Subject: Re: function prototype element ordering Message-ID: <20210927092236.GC20117@1wt.eu> References: <20210910031046.G76dQvPhV%akpm@linux-foundation.org> <202109211630.2D00627@keescook> <202109211757.F38DF644@keescook> <6a85bbbf952949118cc5f93b57d48265@AcuMS.aculab.com> <6a84e8b3fa07483092ae79aeded81797@AcuMS.aculab.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6a84e8b3fa07483092ae79aeded81797@AcuMS.aculab.com> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Sep 27, 2021 at 08:21:24AM +0000, David Laight wrote: > Putting '} else {' on one line is important when reading code. I used not to like that due to "else if ()" being less readable and less easy to spot, but the arguments you gave regarding the end of screen are valid and are similar to my hate of GNU's broken "while ()" on its own line especially after a "do { }" block where it immediately looks like an accidental infinite loop. However: > But none of this is related to the location of attributes unless > you need to split long lines and put the attribute before the > function name where you may need. > > static struct frobulate * > __inline .... > find_frobulate(....) This is exactly the case where I hate to dig into code looking like that: you build, it fails to find symbol "find_frobulate()", you run "git grep -w find_frobulate" to figure what file provides it, or even "grep ^find_frobulate" if you want. And you find it in frobulate.c. You double-check, you find that frobulate.o was built and linked into your executable. Despite this it fails to find the symbol. Finally you open the file to discover this painful "static" two lines above, which made you waste 3 minutes of your time digging at the wrong place. *Just* for this reason I'm much more careful to always put the type and name on the same line nowadays. > Especially if you need #if around the attributes. This is the only exception I still have to the rule above. But #if by definition require multi-line processing anyway and they're not welcome in the middle of control flows. Willy