2013:auto_-_a_necessary_evil

This is an old revision of the document!


Back to proposals-2013

Title: Auto - a necessary evil?
Proposer: roger_orr
Type: Presentation
Duration: 90 minutes
Description: C++11 repurposed an old keyword “auto” to allow you to declare a variable with a deduced type.

For example “auto i = 10;” declares a variable “i” of type “int”.

There were several motivations for providing a new meaning for this keyword. However, like many things, once a new feature is provided people will find creative things to do with it that may well go beyond the original expectations of the people who first made the proposal.

In this talk I will look at the times when you *must* use auto (which makes it 'necessary'.) I will then look at the interesting cases when you *might* use it - or perhaps abuse it (which makes it 'evil'). I also expect to cover some places when you may *not* use auto and a few 'gotchas' where you may not get what you expect!

I will try to identify the stengths and weaknesses of using auto so that you can make informed decisions in your own codebases about when auto should – and should not – be used.

The talk will be mostly focussed on C++ although I may compare and contrast with similar facilities in other languages, such as 'var' in C#.

2013/auto_-_a_necessary_evil.1352111302.txt.gz · Last modified: 2016/06/11 14:05 (external edit)