Udostępnij za pośrednictwem


That auto keyword in C++ 11, not your Dad’s auto

Well that is if you Dad used C++. Unless he is using C++ 11, then it would be your Dad’s auto.

If you write:

auto intk;

Returns an error because intk has not been initialized. You can initialize the variable by doing the following:

auto intk=787;

Then the compiler knows that the variable type is an integer.

This means that if you write the following:

double dblThingSensor(); //Or however you do the case thing, I give up on a standard

Then you write:

auto calcThingSensor = dblThingSensor;

Now calcThingSensor is a variable of type double.

In the ISO/IEC specification see Section 3.1.10