c++ - auto in c++11 is static typing or dynamic typing -
is auto command in c++11 static binding(typing) or dynamic binding?
i.e. if have code
auto x = 5;
will compiler decide "x" int, or descovered on runtime?
also, type of x in following code?
auto x = 5, y = 4.5
this called type inference. typing still static, leave compiler figure out type of expression is.
specifically auto x = 5;
, @ compiler time, is translated int x = 5;
. reason have provide unambiguous expression @ initialization. example auto x;
wouldn't work.
Comments
Post a Comment