3 ms·
I can answer 2 and 3 2. Apache maintains a list of which compilers support what. http://wiki.apache.org/stdcxx/C%2B%2B0xCompilerSupport http://wiki.apache.org/
by JamesLeonis 14y ago
I can answer 2 and 3
2. Apache maintains a list of which compilers support what. http://wiki.apache.org/stdcxx/C%2B%2B0xCompilerSupport http://wiki.apache.org/stdcxx/C%2B%2B0xCompilerSupport
3. The auto keyword isn't supposed to be magic. Rather it's for catching complex types that aren't easily to discover, such as the returns of template functions and iterators, and making it easier on the programmer by not forcing the typing out of long types. The type is resolved at runtime (as best as I am able to tell) and can help clean up some of the messiness of template programming.
- pja 14y agoNo, the type implied by an auto declaration is resolved at compile time.
- JamesLeonis 14y agoDOH! My mistake! Thanks for the catch.
- toemetoch 14y agoThanks for answering those two. The reason I'm not happy with "auto" is that as a programmer you'll end up hunting down types in source. Even more so if you inherit code from someone else. So we'll add them in comment as mental note instead of properly declaring them? You call it messiness (visual clutter in the article) but in my experience it'll promote laziness and pitfalls for beginners. It's just a matter of time before you'll see questions like 'why does the compiler infer the wrong type here?' on StackOverflow. Re-reading my post I see it's easily interpreted as arrogant. That wasn't my intention.