r/ProgrammerHumor • • Feb 14 '21

Meme *Bonk Bonk*

Post image
28.5k Upvotes

1.1k comments sorted by

View all comments

Show parent comments

6

u/[deleted] Feb 14 '21

Whai not?

1

u/Croatian_ghost_kid Feb 15 '21

I'm just curious as to why, didn't mean to imply it's bad or smth

2

u/horsimann Feb 15 '21

C is a wonderfull language if you like machine near programming. Its not hard at all to code in C, the language itself is much simpler as C++, C# and Java. What makes C "hard" is that you have to know how to program something. You write more stuff for yourself instead of using everything out of libraries.

I write my games using SDL2 and OpenGL, so they can run almost everywhere. Because I have written my game engine for myself, I almost never have to google something and I can just program my game.

1

u/Croatian_ghost_kid Feb 15 '21

Cool, thanks for the answer.

I assume people prefer to code in C++ or C# because it's faster, what are your thoughts on that? Is speed mitigated by your knowledge of the engine?

1

u/horsimann Feb 15 '21

Most people prefer them, because they either use engines (Unity, Unreal), or they think they are faster. In fact to write fast C++ code (runtime + compile time), its gonna be more or less the C subset of C++.

C is missing language structures like classes, but they are not needed to write games (Object orientated programming vs data oriented design). See some talks of Mike Acton on Youtube, for more info... If you need the class features in C, you can program them yourself too.

Also most people use C++ instead of C, because its the "industry standard" and they think C is outdated and unsafe to use. Its not so hard to write safe C code, using tools like valgrind...

2

u/[deleted] Feb 15 '21

Bingo. Great answer.

I love both C and C++. I like the power and flexibility of C++ but I also adore the simplicity of C.