So you think you know C? (2016)
191–200 of 344 posts
Re: So you think you know C? (2016)
#192Earlier quoted context omitted.
Strong agreement here. You can limit yourself by choice to certain areas of the language that you know inside out (you know the asm they produce, etc.) and use it to solve problems. Don't worry about every single corner case. As you said, you can easily forget those things, especially if it's not your day-to-day job. The same idea and principle can be found in "JavaScript - The Good Parts".
Having recently been doing some web development, I'd argue that JavaScript's design (even today, despite some modern additions) is so conducive to undebuggable spaghetti code (i.e. this ) that there really are no good parts. Sometimes the technology is objectively the wrong choice i.e. compiling javascript to native code (Not a JIT).
No, I won't name names.
Re: So you think you know C? (2016)
#193Earlier quoted context omitted.
I couldn't agree more. After spending many years working with LLVM, which is at its heart a C compiler, and understanding why it has to do the sometimes-terrifying things it has to do to get C to run well, I've become very paranoid when writing C or C++. My C/C++ code is as boring as possible. (In fact I try to avoid writing C or C++ whenever possible these days; undefined behavior in the language is too pernicious a…
What would we write drivers in then if C was obsoleted?
Re: So you think you know C? (2016)
#194Earlier quoted context omitted.
I couldn't agree more. After spending many years working with LLVM, which is at its heart a C compiler, and understanding why it has to do the sometimes-terrifying things it has to do to get C to run well, I've become very paranoid when writing C or C++. My C/C++ code is as boring as possible. (In fact I try to avoid writing C or C++ whenever possible these days; undefined behavior in the language is too pernicious a…
What would we write drivers in then if C was obsoleted?
Re: So you think you know C? (2016)
#195Having written a conforming C compiler, at one point I knew everything there was to know about C (I forget details now and then, or confusing them with C++ and D). But knowing every engineering detail is not the same thing as knowing how to program in C effectively. It's like being the engineer who designs a Grand Prix car. It does not mean you can drive it faster around the track than anyone else. Not even close. Fo…
I couldn't agree more. After spending many years working with LLVM, which is at its heart a C compiler, and understanding why it has to do the sometimes-terrifying things it has to do to get C to run well, I've become very paranoid when writing C or C++. My C/C++ code is as boring as possible. (In fact I try to avoid writing C or C++ whenever possible these days; undefined behavior in the language is too pernicious a…
One advantage to being an older programmer is I don't feel any need to show off any more. I try to make it so obvious that anyone would look at it and think that's so simple, anyone could do it.
It's surprisingly hard to write simple code. Any idjit can come up with Rube Goldberg code.
Re: So you think you know C? (2016)
#196Re: So you think you know C? (2016)
#197Earlier quoted context omitted.
pcwalton might have an opinion :). He is Rust lead designer.
Not lead designer :) But yes, Rust, or even in userspace, as newer and/or more microkernel-ish OS's allow for. Apple is doing work to allow drivers to be written in Swift...
Re: So you think you know C? (2016)
#198Earlier quoted context omitted.
Having recently been doing some web development, I'd argue that JavaScript's design (even today, despite some modern additions) is so conducive to undebuggable spaghetti code (i.e. this ) that there really are no good parts. Sometimes the technology is objectively the wrong choice i.e. compiling javascript to native code (Not a JIT).
Some languages do fight your attempts to write good code every step of the way :-) No, I won't name names.
It's not finished but let's just say I've managed to make yours and Andrei's thoughtful design into a monster
Re: So you think you know C? (2016)
#199There are a few problems with the questionnaire. "I don't know" is pretty generic choice to be given/choosen. Say for example, in question 5, the statement "return i++ + ++i;" is undefined, because the value of i is read and modified twice in a single sequence point (and of course, the order of addition is unspecified), which is not allowed in C. So the answer is "Undefined." (The explanation given in the page not ac…
> So the answer is "Undefined." The code is undefined, but "I don't know." is still the correct answer for what happens to the variable.
Actually, as undefined behavior should not be used at all then the correct answer should be "nevermimd these examples, they are all bug-ridden".
Re: So you think you know C? (2016)
#200Earlier quoted context omitted.
> The code is undefined, but "I don't know." is still the correct answer for what happens to the variable. Well, then a better choice would be "I can't know."
"I cant know" is a subset of "I dont know" "I dont know" was absolutely the correct answer.
There is a world of difference between "don't know" and "can't know", as the first implies a shortcoming on the side of the developer while second one states that the question is patently meaningless to someone who does master the language.