http://msdn.microsoft.com/en-us/magazine/cc500572.aspx
I have this link in my Microsoft subscription letter. Maybe it will be of some interest for others...
http://msdn.microsoft.com/en-us/magazine/cc500572.aspx
I have this link in my Microsoft subscription letter. Maybe it will be of some interest for others...
All problems in computer science can be solved by another level of indirection,
except for the problem of too many layers of indirection.
– David J. Wheeler
I liked the fact that he himself is unhappy about some things in C++
This makes me feel better, if even the creator can't change some things, then, at least I should stop rambling about some tiny problems, that usually come by me, sometimes !
Waiting for C++0x although!
Good interview. Loved the bit at the end about cell phones. I love how games, video, cameras, etc. are all being perfected by I still routinely get dropped calls, missed voice mails, etc. Flash over substance, which seems to be the norm anymore.
It still pains me bjarne fully supports the auto keyword. Bah!
*defeated*
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.
What's wrong with the new use of auto?It still pains me bjarne fully supports the auto keyword. Bah!
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
At the surface nothing:
- You get more expressiveness (syntactical);
- You save on keystrokes;
- You minimize (debatable) compile time errors.
Complex template base object declarations are made simpler, I foresee iterators being one of the favorite uses for auto. But also, as suggested on the article, "hard to acquire" types can be easily declared.
However, I believe auto is an accident waiting to happen. For one, you lose semantical expressiveness and you make the code logic harder to follow. auto almost feels like I'm wanting to program in a non typed system; i.e. "I don't know the type, I just know it's some form of X, I can't bothered checking the library documentation, or it is too long to type, so I go with auto. This will work."
But the above argument has it flaws, I concede. I only recently started giving template based programming a hard look. And already I'm faced with annoying type declarations that I wished (truly) had been made simpler. As such, I can only imagine what the above paragraph may look like to a seasoned template based programmer.
My major beef with it is instead the fact the new use of auto is an accident waiting to happen also because of the fact it opens yet another door for bad code. The fact it is openly discussed as a tool for the beginner programmer, by the very same people who are institutionalizing it, only makes this worse. You know what I mean, but for illustration purposes, the following is not something you, I, or anyone else would like to see in the years to come on the C++ board:
And yet, I foresee this is exactly what is going to happen.Code:std::string foo(int x); int main () { auto bar = foo(13); }
EDIT: Note that the loss of semantical value is no minor issue. The amount of inconvinient and confusing bugs that might arise from auto foo = "This is a string"; when written by a programming language beginner is overwhelming. Is auto in this instance helping him, or on the other hand making his life harder for not even making it clear this variable is a const char*? Can we say type obfuscation? I chose this example because, believe it or not, is what you can see here: http://en.wikipedia.org/wiki/C%2B%2B0x
EDIT 2: Just a minor correction; one doesn't need to be a seasoned "template based programmer" (allow me that expression yet again) to experience the need for auto, as anyone who has, for instance, constructed a complex STL container can attest.
Last edited by Mario F.; 05-01-2008 at 09:40 AM. Reason: post was showing an unintentional icon. Removed
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.
I've found it funny to see him discuss the vector<Apple> and vector<Fruit> after seeing same discussion on this forum...
All problems in computer science can be solved by another level of indirection,
except for the problem of too many layers of indirection.
– David J. Wheeler
Thanks, vart, that was a great article. And I also greatly enjoyed the linked paper about multiple dispatch.
The worst part is that it isn't. The type of a string literal is const char[N], where N is the number of chars in the string literal, including the terminator. The type of a wide string literal is const wchar_t[N], same rule.Is auto in this instance helping him, or on the other hand making his life harder for not even making it clear this variable is a const char*?
What does this mean? It means this:
I need to go edit that Wikipedia article.Code:const char *s1 = "foo"; const char *s2 = "foo"; assert(s1 == s2); // Probably true. Compilers generally fold string literals. auto a1 = "bar"; auto a2 = "bar"; assert(a1 == a2); // Definitely false. On a side note, you've just wasted 8 stack bytes for nothing.
All the buzzt!
CornedBee
"There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
- Flon's Law
It makes me happy to see that people find this link useful... So you're wellcome.Thanks, vart
All problems in computer science can be solved by another level of indirection,
except for the problem of too many layers of indirection.
– David J. Wheeler
Quiet right, CornedBee. And yet another reason to be carefull around auto.
But for all purposes the example shouldn't even be there, in my opinion, because it suggests exactly what I'm against with; an oversimplification of its true usefulness that will introduce a new crowd of bad code and hard to track bugs. It pains me especially that it is advertised as being introduced to help the life of newcomers to the language.
Personally I feel auto is an advanced feature that is (un)fortunately extremely easy to use. This contradiction only means use and abuse of auto will probably become all too prevalent.
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.
Probably. But as one of those seasoned template programmers you refer to, I'm way too happy about auto to care about its abuse by newbies.
All the buzzt!
CornedBee
"There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
- Flon's Law
Good read. I'm concerned with auto but I guess I'll get used to its uses and abuses. Bjarne seems to be a fundamentals type fella which is nice because he realizes that new bells and whistles or the latest greatest thing does not always make a good language. Overall I like the new features that were mentioned and look forward to learning and working with the new standard (sometime in the next few years?). Since it was 2003 to 2005 before most compilers caught up to the most recent standard I doubt I will see a compiler up to the new standard for quite some time.
All the buzzt!
CornedBee
"There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
- Flon's Law
An offtopic question:
What that means?Originally Posted by CornedBee
It means, "All the best!", that is, a well-wishing, with altered spelling to make a pun on my username. I've been using it as long as the username exists.
All the buzzt!
CornedBee
"There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
- Flon's Law