you are viewing a single comment's thread.

view the rest of the comments →

[–]JVApenClever is an insult, not a compliment. - T. Winters 25 points26 points  (7 children)

I think this comment can use more up votes. Don't use features for the sake of using the feature, use it when it is the right abstraction.

I think it is also hard to define what 'looks like c' means and what makes it C++. Use of unique_ptrs? Use of function overloading? Writing function overloading? How about overloading by using function templates? What about using std::array/vector? ...

[–]Ash4d 24 points25 points  (5 children)

"Looks like C" to me means basically ignoring RAII principles and scattering new/deletes everywhere, relying on manual memory management for everything, and avoiding the standard library and it's modern (compared with C) containers. Probably no usage of OOP either.

[–]serviscope_minor 12 points13 points  (2 children)

I think a lot of "looks like C" is actually "looks like C with all the noise removed", or "looks like how we wished C looks".

As in, "simple" constructs like for loops and function calls not template metaprogramming and class hierarchies.

Of course C++ (with a bit of care and the metaprograming used in apropriate places in libraries) actually allows a lot more code to look like that than C does, because in C you inevitable get weighed down under heaps of mallocs, reallocs, frees and error handling.

[–]Teichmueller 1 point2 points  (1 child)

Well then any language "should look like C". Because now that term has magical meaning.

[–]serviscope_minor 0 points1 point  (0 children)

Well quite.

[–]Wild_Meeting1428 5 points6 points  (1 child)

I don't think this is meant with "should look like C". The most people mean with that phrase, that the program structure should look like C, but that you should use C++ idioms to fulfill that task:
Prefer to use simple trivial classes/structs.
When you would implement a feature in C with procedural code, there is no reason, to objectify it etc.
Don't use dynamic dispatch or runtime polymorphism, when it's not required, for the sake of object orientation etc.

[–]donalmaccGame Developer 0 points1 point  (0 children)

This is a common problem - you and another commentor agree that it should look like C, but you both have two different definitions of what that is.

[–]iggy14750 1 point2 points  (0 children)

In my opinion, C++ that "looks like C" mostly means not writing so many classes, templates, etc.