Live data from Hacker News

Popular Myths about C++, Part 3

isocpp.org

11–20 of 114 posts

Re: Popular Myths about C++, Part 3

#12
post #11
post #7

The C greater function is unnecessarily long int greater(const void* p, const void* q) { return *(double *)p - *(double *)q; } would work just as well. EDIT: DON'T USE THIS, WONT ALWAYS WORK

Don't do this. It has overflow issues.

You are right. He was really careful in picking double instead of int for this example.

Re: Popular Myths about C++, Part 3

#13

In 1995 C++ it wasn't a good choice. In 2000 it was a poor decision in most cases. In 2005 it was a bad decision in almost every case. In 2010 it was completely indefensible. It is almost 2015, why are we even talking about it? C++ was a mistake. A bad detour on the highway of computing.

>"In 1995 C++ it wasn't a good choice. In 2000 it was a poor decision in most cases. In 2005 it was a bad decision in almost every case. "

Was it? Most console games are written in C++ in that period of time. A very popular desktop office suite is built on C++. The most popular design and photograph edition tool for Windows is written using C++.

So you are suggesting that all those guys who picked C++ for those popular piece of software are a sort of lucky morons?

It is a strong and risky assertion don't you think?

Re: Popular Myths about C++, Part 3

#14
post #7

The C greater function is unnecessarily long int greater(const void* p, const void* q) { return *(double *)p - *(double *)q; } would work just as well. EDIT: DON'T USE THIS, WONT ALWAYS WORK

What is the point of defining the function with two void* arguments if the cast will just take place anyway?

Re: Popular Myths about C++, Part 3

#15
post #10

Earlier quoted context omitted.

So what's an alternative?

"C++ sucks" has become a bit of a meme around here. The upsides outweigh the downsides for a surprising number of cases. Every alternative is either immature, doesn't solve the use case that needs C++ or doesn't have the required libraries/tools.

I know. I was hoping he would respond with some misguided suggestion further revealing his ignorance.

Re: Popular Myths about C++, Part 3

#16

In 1995 C++ it wasn't a good choice. In 2000 it was a poor decision in most cases. In 2005 it was a bad decision in almost every case. In 2010 it was completely indefensible. It is almost 2015, why are we even talking about it? C++ was a mistake. A bad detour on the highway of computing.

Because the alternatives to C++ are even worse.

There are still a lot of problem areas where GC is unacceptable, or you need precise control over memory, or access to things like Cuda, along with the high order programming constructs you get in C++.

Maybe Rust will take over some day ...

Re: Popular Myths about C++, Part 3

#17
post #14
post #7

The C greater function is unnecessarily long int greater(const void* p, const void* q) { return *(double *)p - *(double *)q; } would work just as well. EDIT: DON'T USE THIS, WONT ALWAYS WORK

What is the point of defining the function with two void* arguments if the cast will just take place anyway?

The signature of greater is relevant because it has to conform to the interface for qsort. See the final argument of the interface here: http://www.cplusplus.com/reference/cstdlib/qsort/

Re: Popular Myths about C++, Part 3

#18
post #10

Earlier quoted context omitted.

So what's an alternative?

"C++ sucks" has become a bit of a meme around here. The upsides outweigh the downsides for a surprising number of cases. Every alternative is either immature, doesn't solve the use case that needs C++ or doesn't have the required libraries/tools.

I want to point out that Tiobe ranks C++ as the #4 most popular language - http://www.tiobe.com/index.php/content/paperinfo/tpci/index....

I'll just say I'm not a fan of C++ and would rather write my own language similar to the source-to-source compiler idea of HaXe ( http://haxe.org/ ).

Re: Popular Myths about C++, Part 3

#19
"C++ is a big language. The size of its definition is very similar to those of C# and Java."

I can't speak with authority to C#, but C++ is a massively larger core language than Java with far more complicated semantics.

Re: Popular Myths about C++, Part 3

#20
post #10

Earlier quoted context omitted.

So what's an alternative?

"C++ sucks" has become a bit of a meme around here. The upsides outweigh the downsides for a surprising number of cases. Every alternative is either immature, doesn't solve the use case that needs C++ or doesn't have the required libraries/tools.

There are people that sit back and bash C++ and then there are people that just roll up their sleeves and build really cool things with it. I'd certainly rather be in the second camp. I wouldn't mind having a simpler, more elegant language with the same design tradeoffs but that language doesn't yet exist.
Post reply on HN