Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

auto a = 10;

When compiler knows a is int, at compile time or at run-time? If it deduce type at run-time, will it not affect performance?

Thanks

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
785 views
Welcome To Ask or Share your Answers For Others

1 Answer

Compile time. In C++, runtime type information is stripped during compilation(without RTTI or virtual inheritance). It is not possible, in fact, to inspect the primitive type at runtime.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...