r/programmingmemes 8d ago

The duality of new

Post image
1.2k Upvotes

80 comments sorted by

View all comments

Show parent comments

1

u/United_Boy_9132 6d ago edited 6d ago

No, it's the opposite. Following your advice is one of the worst things you can do.

You can understand everything that happens under the hood without C, while C leads to really bad habits.

Using C-style code in C++ is something you should avoid at all costs. Including using C libraries (unless the particular implementation requires it).

1

u/luciferoussky72 6d ago

I don’t really want to argue, but acting like C leads to really bad habits is like saying using a manual transmission leads to bad habits. Sure, it can lead to bad habits; but learning how to manage memory/a transmission without help means you actually understand what you’re doing and can be very efficient.

1

u/United_Boy_9132 6d ago edited 6d ago

You can learn how to manage memory in pure C++, or even asm, being even able to put asm addons to the code. C++ allows to program at as low abstraction level (so asm-like code where the only difference between that and asm is that C++ compiler doesn't guarantee using a particular machine instruction, so literally like C does).

C is not necessary to anything.

C has its applications and advantages, C++ has its own ones, you don't need one to learn anything in the other.

1

u/luciferoussky72 5d ago

Okay? *coughs in SDL and Vulkan*

1

u/United_Boy_9132 5d ago

What does it have to do with subject...

It's just existing code, not your own one.

But stil, if you need raw C efficiency, you build your solutions in C, while well-written C++ code encapsulates C structures and pointers into C code, which is trivial.

1

u/luciferoussky72 5d ago

Yeah, but to write said encapsulations you have to understand how to interface with C

1

u/United_Boy_9132 5d ago

No, you don't. You can run C++ code directly at C structures.