Comment

Comment by earenndil

Some of these absolutely makes sense and are justified; others...are actually sane to have in c++. For instance:

> int foo(void)/int foo()

In c, int foo() means that foo takes any number of args; c++ rightfully realised that that was stupid and removed that feature, which means int foo() can now be used to mean foo takes no args. Also, int foo(void) is illegal in c++.

Varargs in c are a complete pita to use, not to mention they literally do something different from function overloading/default args.

Constexpr is much nicer and safer to use than a macro.

Using malloc and calloc to make class instances means you can have unconstructed objects, which is a Bad Thing, and while introducing a new operator to do that is not necessarily the best way to handle that, it's a perfectly valid way of doing so.

Libc random is just garbage, and libc++ random is actually decent.

setjmp/longjmp are more complicated to use than try/catch, and don't have all the same functionality.

<iostream> functions are type aware (although really they should have used fmt).

I'm no c++ apologist (it's an awful language), but this listicle is just...not great.

parent earenndil 7 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton