Re: Clarifying confusion of our variable placement rules caused by cleanup.h
Bart Van Assche <[email protected]>
| Newsgroups | dev.linux.lists.ksummit,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
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.