TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

C++ is an expert language

3 点作者 muriithi大约 17 年前

4 条评论

pmjordan大约 17 年前
Yep, C++ is unnecessarily complex, suffers from bloated syntax, and is almost as hard to read for a compiler as it is for a human. The point the author has missed is that it's fundamentally not that flawed as a C replacement for projects where C outgrows its usefulness.<p>Okay, so it's essentially destroying itself as a general-purpose language with the complexity and idiosyncracy of some of the additions; a decently standardised ABI would help for embedded stuff. <i>But on the whole I'd rather use std::vector&#60;&#62; than malloc() and free()</i> when it's impossible or exceedingly impractical to use my favourite Lisp, or Ruby if I'm feeling imperative, or Java/C# if someone's forcing me.<p>Yes, you need to know what's going on under the hood, but it can save you a lot of micro-management that slows you down in C. I've come to realise that you have to treat C++ as exactly what the name suggests: a step up from C. If you treat it as anything more, you end up building template empires. Been there, done that, realised it was a bad idea. I'd still pick it over C though.
aston大约 17 年前
This article has some weird examples. I could've sworn most C++ compilers would go ahead and throw in default and copy constructors for you by default. It's only by explicitly defining a <i>lack of</i> one of these that you would hit an error (as he did in his examples). As in, your basic class would be fine, and then as you added special constructors without adding the basic ones, you'd make trouble for yourself. Note that he has to explicitly declare the copy constructor private to break things...<p>Then again, I was never really that far into C++ land, so I wouldn't be surprised if I were wrong.
deathbyzen大约 17 年前
This was slightly interesting to me as I took a few CS courses during my brief stint in college. The professor taught in C++ and made it seem simple which seemed like something of an accomplishment at the time.
keating大约 17 年前
If it crashes, it's probably written in C++.<p>// eof