News for hackers. Stuff that matters.
Re:Teaching C (2016) by geezerjay on Tuesday October 30, 2018 @08:42AM (#18335938)
> I'd like to believe C has a stronger future in the academic world because it is simpler than C++

C is simpler than C++ until we need to manage memory or need to handle basic data structures. When that happens, C requires reinventing the wheel over and over again.

Re:Teaching C (2016) by xamuel on Tuesday October 30, 2018 @11:35AM (#18337610)
Because memory management is an area where C++ over-simplifies and assumes one size fits all. In the C++ worldview, memory allocation is a black box, and no two apps would ever have any desire to use different memory allocation strategies. For many apps, that's fine, but for the type of apps where C shines, memory allocation isn't just a magic black box.

"As simple as possible, but no simpler."

Re:Teaching C (2016) by pjmlp on Tuesday October 30, 2018 @12:18PM (#18338232)
No it doesn't.

In fact C++ allows for flexible memory allocation strategies per data structure, while C forces one to hand code them all and replacing something like malloc affects the whole executable behavior.

Re:Teaching C (2016) by jstimpfle on Tuesday October 30, 2018 @02:53PM (#18340128)
> flexible memory allocation strategies per data structure

You realize that that's not exactly flexible. Tieing shape to behaviour in this way is where the pain starts.

Re:Teaching C (2016) by pjmlp on Wednesday October 31, 2018 @11:12AM (#18346328)
Overloading new/delete, STL allocators, <build your own while giving it as template parameter>, not sure they tie shape to behavior.
Re:Teaching C (2016) by jstimpfle on Wednesday October 31, 2018 @11:16AM (#18346369)
Here, shape = type. Yes, they do. Start thinking why C++ compilation times are so abysmal? Because of this dependency mess. Then realize the same inefficiencies apply to maintainers' heads.
Re:Teaching C (2016) by geezerjay on Tuesday October 30, 2018 @11:38AM (#18337654)
> Because memory management is an area where C++ over-simplifies and assumes one size fits all.

And the fact is that it does. In the rare case that it doesn't then C++ also accomosdates those requirements if developers are willing to put in the same sort of effort that goes into implementing data structures by hand.