Re: [PATCH v2 0/7] Replace "__auto_type" with "auto"

From: Kees Cook
Date: Sun Jul 20 2025 - 14:07:24 EST




On July 19, 2025 11:50:37 PM PDT, "H. Peter Anvin" <hpa@xxxxxxxxx> wrote:
>"auto" was defined as a keyword back in the K&R days, but as a storage
>type specifier. No one ever used it, since it was and is the default
>storage type for local variables.
>
>C++11 recycled the keyword to allow a type to be declared based on the
>type of an initializer. This was finally adopted into standard C in
>C23.
>
>gcc and clang provide the "__auto_type" alias keyword as an extension
>for pre-C23, however, there is no reason to pollute the bulk of the
>source base with this temporary keyword; instead define "auto" as a
>macro unless the compiler is running in C23+ mode.

Yeah, this is good. We have typeof() used extensively in macros all over. I'll try this for fortify macros and see if we see any binary output changes...

--
Kees Cook