I don’t think this is widely known but auto was already a keyword in C++ and also C. Prior to it’s removal in C++09 it was used as a storage duration indicator. What this means is that it tells the compiler how long the storage for the variable needs to last for. The auto keyword is the default and means that the storage is available until the end of the block in which the variable is created. The fact that this is the default behaviour for C++ and it’s infrequent use lead to it being removed from the standard. As Bjarne Stroustrup writes
Several committee members trawled through millions of lines of code finding only a handful of uses — and most of those were in test suites or appeared to be bugs
So onto the new auto. Continue reading ‘Auto’