Originally posted by bnolsen
View Post
Announcement
Collapse
No announcement yet.
John Carmack's Comments On C/C++
Collapse
X
-
-
Originally posted by newwen View PostAs I'm old school (and embedded developer) I still use C. But even with C, my coding rules ban me from using some features of the language. The thing is that C++ has many features that leave a program indecipherable, like operator overloading. Yes, it is a powerful tool, yet it is often misused and makes the code hard to understand.
Being a C programmer, I've always liked Java for it's simplicity. But then again, Java developers tend to abuse OOP paradignms just for the sake of having beautiful object model design. If I had to ask something to Java is unsafe contexts and an easier JNI, just like C# has them.
Anyway, If you write C code, you get a better glimpse of what machine code the compiler may generate.
Leave a comment:
-
Originally posted by sylware View PostThe c++ benefits does not compensate for its technical cost. Then, better stick to C.
I personally would miss exceptions, templates and polymorphism too much.
Leave a comment:
-
my opinion
The c++ benefits does not compensate for its technical cost. Then, better stick to C.
Leave a comment:
-
Originally posted by joe_gunner View PostAnd much of the standard library relies on GC, so what then, roll your own to be sure?
Btw this is a topic about john carmack and c++. How did this turn into a discussion on 'D'? Sometimes I wonder about astroturfing...Last edited by bnolsen; 15 January 2013, 04:46 PM.
Leave a comment:
-
Originally posted by GreatEmerald View PostThat's why D has an option to turn it off.
Leave a comment:
-
Originally posted by bioinfornatics View PostD is far easier to read and write than C++.
At beginning the language had some important bug that is the normal workflow for anything in informatic. Now the language is stable and for new code is better to start with D. Try it now
Leave a comment:
-
Originally posted by plonoma View PostSyntax being easy to read, expressive and flexible seems like it's the most important thing.
(I notice that with the << it's easier to read, produces smaller code and is (less error prone?) shorter than printf.)
(The use of the %s, %d specifiers has an issue since the type specification seems to conflict with the DRY principle of software engineering. )
I'm not a huge fan of "auto" except in very limited cases. It looks like a vehicle for generating unmaintainable/unreadable code. Someone looking at this stuff dry has not idea what datatypes are contained in those variables. I'll limit "auto" for use with those ugly iterator declarations, thank you.Last edited by bnolsen; 15 January 2013, 03:33 PM.
Leave a comment:
-
As I read TFA and the comments here, a slight paraphrase comes to mind... "Those who do not understand/remember classical structured programming are doomed to reinvent it - poorly."
Back in the day, I did a pile of non-trivial code in both Pascal and Modula-2. I never did a device driver, but I did do a re-entrant interrupt handler as a DOS TSR way, way back. I interfaced to C graphics libraries, (SWIG didn't exist, back then, so I wrote .defs by hand.) both read and wrote legacy binary data of multiple types.
Both languages were criticized for "not being able to do anything useful - only writing toy software," but I had quite a bit of useful code written in both. With Modula-2 another common criticism was that it didn't have a good collection of libraries. SWIG didn't exist back then, but I think it would render that issue moot, today. Both languages were also extended to become useful, and that is a valid criticism, though much less so with Modula-2 than with Pascal.
The more common criticism against both was about "programming in a strait-jacket." But here we see Carmack voluntarily donning that strait-jacket in the name of readability and, I presume, reliability, debuggability, etc. What's more, since C/C++ don't directly have the strait-jacket features, he's working hard to get that stuff back with templates. In that same light, look at the fact that we're still seeing software bugs that Pascal/Modula-2 never would have let us make. Obviously there would still be bugs, and no doubt new categories of bugs, but we're still fighting entirely too many trivial bugs, even now.
To be fair, neither Pascal nor Modula-2 were object-oriented without heavy extensions. I did do object-oriented-style programming with Modula-2, just like it can be done with C, but it's nicer when the language helps you. There is another variant called Modula-3 that is object oriented, but I haven't played with it.
Then again, there are Oberon and Oberon-2. Those were Wirth's ventures into OO. The former was more of a teaching/experimental language, like Pascal, while the latter was meant to be practical. I hung out on the Oberon-2 Usenet group for a while. One of those "simplifications" was taking away variant records and the "packed" directive, which was my Swiss-army-knife for accessing legacy binary data. I brought this up on the list, asking how the heck I was supposed to work with legacy binary data. Their answer was to get all of those legacy applications re-coded into Oberon-2. That was about the time I quite following the language.
About that time I shifted platforms to Linux, and never really picked up doing my own compiled code since, past "./config ; make ; make install". I do mostly Python these days. (and still wish for "var" and "const", so I know exactly how things are being passed)
Leave a comment:
-
Originally posted by disgrace View Postthe gc from d is not suitable for AAA games.
And if you're using STL in C++ you probably have to write 'new' or 'delete' about once a year.
Leave a comment:
Leave a comment: