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
Popular Myths about C++, Part 3
11–20 of 114 posts
Re: Popular Myths about C++, Part 3
#12The 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.
Re: Popular Myths about C++, Part 3
#13In 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.
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
#14The 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
Re: Popular Myths about C++, Part 3
#15Earlier 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.
Re: Popular Myths about C++, Part 3
#16In 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.
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
#17The 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
#18Earlier 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'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
#19I 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
#20Earlier 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.