lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <B92B21C0-093D-4F52-A7E3-1A7DDC83749B@zytor.com>
Date: Tue, 25 Nov 2025 09:57:21 -0800
From: "H. Peter Anvin" <hpa@...or.com>
To: Alexey Dobriyan <adobriyan@...il.com>,
        James Bottomley <James.Bottomley@...senPartnership.com>
CC: ksummit@...ts.linux.dev, Dan Williams <dan.j.williams@...el.com>,
        linux-kernel <linux-kernel@...r.kernel.org>,
        Dan Carpenter <dan.carpenter@...aro.org>
Subject: Re: Clarifying confusion of our variable placement rules caused by cleanup.h

On November 25, 2025 6:25:19 AM PST, Alexey Dobriyan <adobriyan@...il.com> wrote:
>On Tue, Nov 18, 2025 at 11:39:26AM -0500, James Bottomley wrote:
>
>> So which should we do?
>
>The best way to understand that C89 style of declaring in the beginning
>of the function is pointless rule is to write some code in a language
>which doesn't enforce it. You should see that nothing bad happens.
>
>It increases bug rate due to increased variable scope allowing typos.
>
>It bloats LOC -- in many cases declaration and initializer can fit
>into a single line.
>
>It prevents adding "const" qualifier if necessary.
>
>Pressing PageUp and PageDown when adding new variable is pointless
>busywork and distracts, breaks the tempo(flow?) so to speak.
>
>C89 style provokes substyles(!) which makes adding new variables even
>more obnoxious: some subsystems have(had?) a rule saying that declarations
>(with initializers) must be sorted by length, so not only programmer has
>to PageUp to the beginning of the block, but then aim carefully and
>insert new declaration.
>
>None of this is necessary (or possible) if the rule says "declare as low
>as possible".
>
>There was variation of this type of nonsense with headers (not only it has
>to be sorted alphabetically but by length too!)
>
>There is no practical difference between code and declarations:
>declarations can have initializers which can be arbitrary complex,
>just like "real" code. So the only difference is superficial.
>
>
>C89 declaration style is pointless and dumb, no wonder other programming
>languages dumped it (or never had), it should be simply discarded.
>
>It will also make Linux slightly less white crow to newcomers
>(C++ doesn't have this rule after all).
>

Preventing the use of "const" is a big one.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ