4 ms·
Auto is just a keyword to invoke/assist type inference in the parser -- the objects are still statically typed. C++ 11x (or however it's called) uses the same.
by coldtea 11y ago
Auto is just a keyword to invoke/assist type inference in the parser -- the objects are still statically typed. C++ 11x (or however it's called) uses the same.
You were probably thinking of something like the "dynamic" type that C# has.
- thechao 11y agoSince Jaakko, my advisor, was one of the core authors for 'auto' in C++11: the use of 'auto' for type inference has been in C since the '70s. C++11 just generalized the feature.
- coldtea 11y agoHuh? Maybe it's a joke, but "auto" in C has nothing to do with auto in C++. In C auto just defines the storage location (and is kinda useless), not the type (which you still need to define).
- thechao 11y agoKind of serious-kind of joking: auto x = 3; "Infers" 'int'. Everything else is an error.