3 ms·
auto is already a keyword in C11, a type of storage specifier (like static or register).
by jcranmer 11y ago
auto is already a keyword in C11, a type of storage specifier (like static or register).
- PeCaN 11y agoYes, 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.
- _kst_ 11y agoExisting code that does "auto x = 3;" is already broken; the "implicit int" rule was removed in C99. But "auto int x = 3;" is valid (and the "auto" keyword is useless in that context).
- jwilk 11y agoFrom <http://www.seebs.net/faqs/c-iaq.html#section-1 http://www.seebs.net/faqs/c-iaq.html#section-1>: 1.8: What's the auto keyword good for? Declaring vehicles.
- PeCaN 11y agoThis is inherited from early Lisp implementations, where it was common to define a struct car { ... }; which would get cumbersome to type.