Live data from Hacker News

Zed Shaw on C++

librelist.com

41–50 of 210 posts

Re: Zed Shaw on C++

#41
post #25

Earlier quoted context omitted.

Uh...I'm talking about the content of the post to which this thread is attached, so: http://librelist.com/browser//mongrel2/2010/7/15/c-verses-c+...

"You'll find crap in C++ like const *const char &, and hell if anyone knows what that really means since even though the pointer to a const to a const reference is consted to hell and back, oh look you can still increment it." I'm still looking for the part where he doesn't understand how const _works_.

"const *const char &" is not valid C++ syntax, so I'm pretty sure you can't increment it. Therefore, anyone saying you can increment it doesn't understand it. QED.

Re: Zed Shaw on C++

#42
post #40
post #33

I agree totally with Zed Shaw on this, but some quick observations: * C++ circa 2000 (before mainline g++ could handle Alexandrescuisms) is significantly different from C++ circa 2010, albeit in ways that probably upset Shaw even more (the more central role boost has taken, the more "expressive" templates have gotten, don't call me on any of this stuff). * C++ std::string is an abomination, but you can always just do…

Alexandrescuisms has 2 hits on google including this page. To what are you referring?

http://erdani.com/book/main.html

Re: Zed Shaw on C++

#43
post #40
post #33

I agree totally with Zed Shaw on this, but some quick observations: * C++ circa 2000 (before mainline g++ could handle Alexandrescuisms) is significantly different from C++ circa 2010, albeit in ways that probably upset Shaw even more (the more central role boost has taken, the more "expressive" templates have gotten, don't call me on any of this stuff). * C++ std::string is an abomination, but you can always just do…

Alexandrescuisms has 2 hits on google including this page. To what are you referring?

Start here: http://en.wikipedia.org/wiki/Andrei_Alexandrescu

Re: Zed Shaw on C++

#44

I've seen this pattern a lot when it comes to the order of learning/mastering languages: C, then C++, then back to C

After getting use to the STL containers... I could never go back to pure C. I use C++ daily and love it. Nothing against C (if that's what you like) it's a great little language.

Why is it that C programmers bitch about C++, but C++ programmers don't bitch about C?

Re: Zed Shaw on C++

#45
I always see streams brought up as a critique of C++, at least compared to how it is handled by C, and I agree that they are terrible. However, everyone else also agrees that they are terrible, and as an added bonus the C IO functions are still available.

C++ brings a lot of heavy-weight machinery to the table but the best part is that you don't have to use it. If you just want to write C but desire templates to reduce the amount of writing you need to do then so be it, write C-with-templates!

My big beef with the language is mostly due to the legacy crud it is saddled with in the C preprocessor. Many of the build time issues I find myself suffering with are because of people, for example, including Windows.h a) in the first place and b) not defining WIN32_LEAN_AND_MEAN. Junior (and senior, for that matter!) developers seldom know how to properly structure their code so that their iteration times don't plummet.

Re: Zed Shaw on C++

#46
post #32
post #16

Exceptionally good critique. But there are exceptions: programming for Google's V8 in C++ is a pleasure. I've never seen any interpreter code so clean and easy to extend. Like a breath of fresh air.

I don't know if V8 follows the Google C++ Style Guide[1] (I doubt it, but it is possible), but that could explain a lot. I feel that it provides a good balance between power and readability. You don't have the language-within-a-language pattern that arises in some of the boost libraries, but you do get RAII and a few template tricks. The language feels much like a cleaner Java, with very few opportunities to do somet…

V8 mostly follows it: http://code.google.com/p/v8/wiki/Contributing

Re: Zed Shaw on C++

#47
post #33

I agree totally with Zed Shaw on this, but some quick observations: * C++ circa 2000 (before mainline g++ could handle Alexandrescuisms) is significantly different from C++ circa 2010, albeit in ways that probably upset Shaw even more (the more central role boost has taken, the more "expressive" templates have gotten, don't call me on any of this stuff). * C++ std::string is an abomination, but you can always just do…

The problem with std::string is that when I type a quoted string in my code, it isn't natively a std::string, it's natively a char* and gets converted to strings. C++'s biggest mistake was not standardizing early on an official object-oriented string datatype. It should have been in the first version of C++, it should have been treated like a primitive type (even if it isn't), and they should have said "thou shalt use this type for your strings". It makes me sick every time I see some goofy custom string class.

One problem with const-correctness is C++ uses "const&" to mean two different things: it could mean either a reference to a persistent object you're not allowed to change, or it could refer to a temporary object which you're prevented from changing because the changes will disappear. The problem is it conflated access control with lifetime. It would have been better if there were a "temp" keyword - although the last thing C++ needs is more combinatorics of type decorators.

On the subject of consts, though, C++ simply enforces const correctness more, but doesn't the same criticism of confusing const apply to pointers in C as well? You can just as easily declare a "const * const" in C as in C++. So I fail to see why Zed Shaw writing something in C gets him away from that "problem", unless he doesn't write const correct C.

Re: Zed Shaw on C++

#48
I like C or C++ for native but use C++ more because I write it with simplicity. Complex C++ like MFC, Windows API, template hell is disgusting and wrongly gave C++ a bad name.

C++ OO can be done to really abstract the application but still be very manageable and simple. Also C++ is a game industry cornerstone. I think game code in C is actually harder to consume that game code in C++.

Re: Zed Shaw on C++

#49
post #33

I agree totally with Zed Shaw on this, but some quick observations: * C++ circa 2000 (before mainline g++ could handle Alexandrescuisms) is significantly different from C++ circa 2010, albeit in ways that probably upset Shaw even more (the more central role boost has taken, the more "expressive" templates have gotten, don't call me on any of this stuff). * C++ std::string is an abomination, but you can always just do…

I like the QT library. It is an alternative to all this absurdity. QT's strings, streams and containers have infinitely better syntax than the bondage and discipline of STL. And QT may not be standard but it's going to be more widely used and supported than any string class I might roll myself.

Re: Zed Shaw on C++

#50
post #44

I've seen this pattern a lot when it comes to the order of learning/mastering languages: C, then C++, then back to C

After getting use to the STL containers... I could never go back to pure C. I use C++ daily and love it. Nothing against C (if that's what you like) it's a great little language. Why is it that C programmers bitch about C++, but C++ programmers don't bitch about C?

Because we're having too much fun writing cool things in C++ to bother to write rants.
Post reply on HN