Live data from Hacker News

What if anything have we learned from C++? [video]

youtube.com

1–10 of 56 posts

Re: What if anything have we learned from C++? [video]

#3
post #2

After twenty years of using it? That I was wrong, that plain-old C really is better.

The C that you call "really is better" is not the C which existed before C++. It is "K&R C", which looked like this:

  foo (a, b, c)
  char *a;
  int b, c;
  {
     /* do something cool here */
  }
And there were no "function declarations" (who needs argument type and cardinality checking anyway), no "slash slash" single line comments, no need to declare a return type as int was implied, say goodbye to const and volatile qualifiers, any char array is mutable (including those defined in double quotes), plus be sure to use function pointers thusly:

  (*some_pointer) (insert, args, here);
Instead of:

  some_pointer (looks, like, a, function);
Oh yeah, and say adios to struct initialization using the C89 syntax. And it's a no-no to try and initialize a local array along the lines of:

  char *strings = {
    "this", "is", "convenient", "isn't", "it?"
    };
So if you wish to assert (pun intended) "that plain-old C really is better", then be sure to acknowledge where a non-trivial amount of what is known as "plain-old C" stems from.

Re: What if anything have we learned from C++? [video]

#4
post #2

After twenty years of using it? That I was wrong, that plain-old C really is better.

The C that you call "really is better" is not the C which existed before C++. It is "K&R C", which looked like this: foo (a, b, c) char *a; int b, c; { /* do something cool here */ } And there were no "function declarations" (who needs argument type and cardinality checking anyway), no "slash slash" single line comments, no need to declare a return type as int was implied, say goodbye to const and volatile qualifiers…

by plain old, i think infradig was implying that C was plain and old compared to C++, and not about an older standard of C.

Re: What if anything have we learned from C++? [video]

#5
post #4

Earlier quoted context omitted.

The C that you call "really is better" is not the C which existed before C++. It is "K&R C", which looked like this: foo (a, b, c) char *a; int b, c; { /* do something cool here */ } And there were no "function declarations" (who needs argument type and cardinality checking anyway), no "slash slash" single line comments, no need to declare a return type as int was implied, say goodbye to const and volatile qualifiers…

by plain old, i think infradig was implying that C was plain and old compared to C++, and not about an older standard of C.

Yes, plain-old C like plain-old vanilla ice cream, as compared to C++ like swirly rainbow vanilla chocolate strawberry template macro class inherits from a waffle cone with generic unique pointer functor sprinkles ice cream.

Re: What if anything have we learned from C++? [video]

#7
"most researchers prefer an inefficient language because it's easier to get a paper to improve an inefficient language... I've seen dozens of papers on getting lisp almost as fast as C++, on getting Java almost as fast as C++. You can't do that with C++".

A paper from the man himself on getting a type switch in C++ almost as fast as what you get in OCaml. http://www.stroustrup.com/OOPSLA-typeswitch-draft.pdf

Lot's of other places where he's omitting things because he wants to plug C++.

Also, he also seems to be confused between "an efficient language" and "a language that allows you to create something that runs efficiently".

Re: What if anything have we learned from C++? [video]

#8
post #2

After twenty years of using it? That I was wrong, that plain-old C really is better.

What I've learnt is that if you start writing C++ as a plan-old C, you quickly find yourself reaching for this and that feature from C++ that makes your job easier and your code more readable. Knowing where to stop is the tricky part.

Re: What if anything have we learned from C++? [video]

#9
I started programming in C++ in the late 90's and I used to be confused about what features to use and found it easy to make a mess.

But I am happy I stuck with it as it opened up opportunities to work in a lot of different and interesting domains like games, mobile apps, interactive art installations, trading systems and video and film processing apps. Also, most of my code is platform independent and very efficient.

There are a few interesting alternatives at the moment, namely Rust and Swift, but for now C++ does everything I want and since C++11 it really feels like a much more modern language.

Re: What if anything have we learned from C++? [video]

#10
This video was more engaging than I was expecting. To the point that I am not sure what I was expecting.

There did seem to be too much apologizing for how other people messed up the original idea of C++. Same for patronizing much of the industry. I can't claim it was unwarranted, but a lot of patronizing.

Post reply on HN