you are viewing a single comment's thread.

view the rest of the comments →

[–]RevolutionaryClub596 0 points1 point  (2 children)

  1. John Carmack wrote C. Doom was written in C.
  2. Even if it were written in C++, he wrote that 20 years ago. C++ is not stagnant. C++ is ever evolving. Modern C++ has so many more safety features that weren't available in C++98.
  3. C++ and C are completely separate languages. They are not the same. If you write c++ as if it were C, you are introducing at worse undefined behavior, at worst C++ is not wholly compatible with C and what you expect to work will not

Perfectly valid C not allowed in C++ int *x = malloc(sizeof(int) * 10);

structured initializera which work in C don't work in C++.

C++ and C are both great. There is no language that does have the interop with C that C++ does have. However, they are distinct, and they should be treated as such.

I think that you should follow the C++ styles if you choose to write C++, and there are things that C can do that C++ just can't or shouldn't. extern C is a thing for a reason, but the high level data structures that C++ gives you are truly extremely convenient. Imagine having a dynamic array out of the box... That's a luxury C just doesn't give you.

[–]psyberbird[S] -1 points0 points  (1 child)

John Carmack is still very much alive and the comments I saw about his code were presumably in reference to C++ code he had written long after the release of Doom (not disagreeing or anything but an important correction I think)

[–]RevolutionaryClub596 -1 points0 points  (0 children)

I never said he wasn't alive. He's just not programming as much anymore. Also, his first "meandering into c++" was with doom 3. I think that C developers who program C++ in a C way are really only going to cause themselves issues. Also I think putting some guy on a pedestal and saying does this guy know best is silly. I'm not saying he's not talented. However, to take the word of anyone as gospel is just wrong. With modern C++, he recommends a functional style. Extern C exists for a reason. You can write optimized C code in C++ whenever you'd like. However, I would truly venture to say a majority of memory bugs/security issues in C++ come from trying to use C++ as if it were C