C++11 Auto Keyword

This is just a short post to illustrate the use of the auto keyword. It’s something really simple from the latest standard that you can use in your programs and it will save you typing time ๐Ÿ™‚ .

So, the auto keyword has always been around, but it was pretty much redundant. ‘auto’ was the default storage duration specifierย of any variable that you declared, even if you didn’t state it as such. That means that it would be allocated space at the start of the enclosing block of code, and deallocated space at the end.

To put it into context, if you didn’t use auto, you’d use extern or static. It’s a way to tell the compiler how long you want the variable available.

Read moreC++11 Auto Keyword