Archived

This topic is now archived and is closed to further replies.

Shannon Barber

auto keyword

Recommended Posts

pizza box    168
I haven''t seen any instances where auto was used or have thought of a useful application for it. My guess is that they included it for compatibility with previous versions of C/C++ that didn''t initialize all variables as automatic.

Share this post


Link to post
Share on other sites
Fruny    1658
You don''t need it anymore : unqualified variables are assumed auto by most if not all ''modern'' compilers.

Share this post


Link to post
Share on other sites
Kylotan    10009
I believe there''s a rare situation where a variable declaration can be mistaken for a function prototype or something like that. In the 3rd edition of The C++ Programming Language, Stroustrup makes a reference to a situation where the auto keyword makes a difference, but doesn''t show an example sadly.

Share this post


Link to post
Share on other sites