Thread: Bjarne Stroustrup on the Evolution of Languages - Interview MSDN Magazine Apr 2008

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #19
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    Quote Originally Posted by Elysia View Post
    I kinda like the auto keyword for simplifying some types, especially iterators. But I am concerned, as Mario points out, that it may leave the door open to bad things. IMHO, it should be limited in ways it could be used.
    But I'm definitely glad it's there.
    I'm not sure of any way it could be limited. The use of auto is much better described as a means to deduce a type from the initializer in order to simplify generic programming (generic programming, the expression I was drawing a blank on my previous posts). Examples of auto that translate to built-in types are in my opinion not a good example of proper usage of auto.

    I'm not sure if your edit of the wikipedia article was a joke, CornedBee. I'm wanting to believe not. However, what you are essentially doing is giving an example on how auto shouldn't be used; i.e. While essentially correct, the example fails however to provide auto with a proper context. And that is almost certainly more confusing to the reader. No one will suddenly not understand what auto is, if instead something like this is shown:

    Code:
    for (auto itr = vec.begin(); itr != vec.end(); ++it) {
        std::cout << *itr << std:endl;
    }
    Probably this is a non-issue as I'm wanting to believe textbooks will be less inclusive on the matter of auto usage. However, for the most part, bad habits are born of imitation and I completely fail to see why one should be so lenient when it comes to provide usage examples and so adamant when it comes to correct the code of others. Code, I may add, very often is the result of what was read and understood from said examples.
    Last edited by Mario F.; 05-02-2008 at 06:22 AM.
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. An Interview with Bjarne Stroustrup By Michael Miller
    By kermi3 in forum Article Discussions
    Replies: 9
    Last Post: 03-15-2005, 10:59 AM
  2. Interview with Bjarne Stroustrup "C++ a joke"
    By novacain in forum A Brief History of Cprogramming.com
    Replies: 4
    Last Post: 03-31-2003, 11:55 PM
  3. Exclusive Interview With Bjarne Stroustrup
    By Osama Lives in forum A Brief History of Cprogramming.com
    Replies: 7
    Last Post: 05-07-2002, 03:17 PM