Re:C – Preliminary C2x Charter
by ainar-g on Thursday March 17, 2016 @11:37AM
(#11305011)
On auto. Couldn't they just define auto as
and then add a header like <stdauto.h> which does
like they did with _Bool in C99?
[ Parent
| on HN ]
auto is already a keyword in C11, a type of storage specifier (like static or register).
From <http://www.seebs.net/faqs/c-iaq.html#section-1>:
1.8: What's the auto keyword good for?
Declaring vehicles.
This is inherited from early Lisp implementations, where it was common to define a
struct car { ... };
which would get cumbersome to type.Yes, that's exactly why they'd use _Auto and a header to redefine the keyword. Existing code that does auto x = 3; (implicit int type) wouldn't break, but #include <stdauto.h> auto x = 4.2f; would be the new meaning.