[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <82a250e0-de9e-467a-882e-7acefbfd7c24@acm.org>
Date: Tue, 18 Nov 2025 11:04:55 -0800
From: Bart Van Assche <bvanassche@....org>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: James Bottomley <James.Bottomley@...senpartnership.com>,
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 11/18/25 10:38 AM, Linus Torvalds wrote:
> Now, we currently don't use __auto_type very much outside of macros
> (and there we often use "typeof(x)" instead for historical compiler
> reasons), but I suspect we probably should. There's a patch floating
> around that makes it more convenient with a
>
> #define auto __auto_type
>
> because the historical C 'auto' keyword has been so completely and
> utterly useless.
In a C++ style guide I found the following advice for type deduction:
"Use type deduction only if it makes the code clearer to readers who
aren't familiar with the project, or if it makes the code safer. Do not
use it merely to avoid the inconvenience of writing an explicit type."
However, I'm not sure whether this guidance also makes sense for C
kernel code. See also
https://google.github.io/styleguide/cppguide.html#Type_deduction
Thanks,
Bart.
Powered by blists - more mailing lists