jeudi 29 novembre 2018

Deduced type of auto variable in for statement

Considering following code snippet:

  for (auto loopcontrol = 0; loopcontrol < 10; loopcontrol++)
  {
     ...
  }

How is the type of loopcontrol deduced?

On the C++ compiler I use (Microsoft Visual Studio 2017) it is int, but why not e.g. long?

Is it the type of 0?

Aucun commentaire:

Enregistrer un commentaire