Welcome, Guest. Please login or register.

Author Topic: C vs C++ ... or whatever language  (Read 20954 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline Mr_Capehill

  • Full Member
  • ***
  • Join Date: May 2002
  • Posts: 189
    • Show all replies
Re: C vs C++ ... or whatever language
« on: February 10, 2018, 08:19:46 PM »
Quote from: kamelito;835995
@Dayntona, Hand & Thor
I don t think That shipping successfully 2 games like Braid and The Witness make him a bad C++ programmer. Check his YouTube channel or better ask him directly on Twitter.
It seems that not a single C++ book did a good job teaching how to program properly in C++. Who need a phone book size one to just scratch the surface? Why big games companies need to wrote their own STL implementation to have good performance?


Which game companies rewrite the STL lib in 2015-2018? What exactly was the reason?

Something like std::vector is as fast as the C array.

C++ is a complex topic, that cannot be denied. But C++ today is also quite different to what it used to be. Check constexpr, auto, unique_ptr and ranged-for...
 

Offline Mr_Capehill

  • Full Member
  • ***
  • Join Date: May 2002
  • Posts: 189
    • Show all replies
Re: C vs C++ ... or whatever language
« Reply #1 on: February 10, 2018, 08:23:04 PM »
Quote from: Daytona675x;835998

"Effective C++" line of books by Scott Meyers. If you understood those, then go for
"Modern C++ Design" by Alexandrescu and finally
"C++ Templates" by Vandevoorde / Josuttis.


Yay for mentioning Scott Meyers! Can't go wrong with his advice.

Check also ETL: https://github.com/ETLCPP/etl
 

Offline Mr_Capehill

  • Full Member
  • ***
  • Join Date: May 2002
  • Posts: 189
    • Show all replies
Re: C vs C++ ... or whatever language
« Reply #2 on: February 11, 2018, 08:16:29 AM »
Quote from: kamelito;836016
Performance was the reason, EA for example their implementation is now open source.
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2271.html


Posted in 2007.

But hey, the more the merrier. People can use STL, ETL, EASTL or roll their own. It's just a toolbox, not religion.
 

Offline Mr_Capehill

  • Full Member
  • ***
  • Join Date: May 2002
  • Posts: 189
    • Show all replies
Re: C vs C++ ... or whatever language
« Reply #3 on: February 11, 2018, 08:22:24 AM »
Quote from: Thomas Richter;836014
Actually, when I tested, it was not. There is another layer of indirection, and at least the GNU C++ compiler is not good at removing the overhead even in optimized mode. There is also the "valarray", but that is neither any faster. Yes, it almost all cases it does not matter. But if you do raw signal processing, then the best C++ offers you is the raw pointer (well, except if you have compiler intrinsics for vectorized operations, of course), and this particular case, it does matter.


What sort of test case? I have used std::vector to take care of memory management and just passed the pointer (myVector.data()) to OpenGL, for example.