Ladies and gentlemen, the C programming language. It’s a classic. It is blindingly, quicksilver fast, because it’s about as close to the bone of the machine as you can get. It is time-tested and ubiquitous. And it is terrifyingly dangerous.
The author's biggest issue with the C language seems to be security holes:
If you write code in C, you have to be careful not to introduce subtle bugs that can turn into massive security holes — and as anyone who ever wrote software knows, you cannot be perfectly careful all of the time.
The author claims that the Rust language is a modern answer to these issues and should replace C (and C++). It does look that Rust can run C code, so it looks like an interesting proposition. What do Soylent's coders think about this?
(Score: 5, Insightful) by Anonymous Coward on Friday May 08 2015, @10:56PM
Your string can't have any zeros in it. So you can't store an arbitrary binary blob like a JPEG picture in a C string.
Stopped reading there. Clearly the writer of this article is incompetent in regards to C. You can store arbitrary 0x00 anywhere in a char[] just fine, you just can't use the built-in string manipulation functions on it, which you shouldn't if you aren't storing 0-terminated strings in the first place.
Fundamental types in C represent fundamental types in your CPU. A char is defined as a byte. A char* is a memory address whose value can be represented as a byte. That's all it means. The standard library provides the means to handle char* as a 0-terminated string, but you are not required to, and in fact, it's very common not to.
If you need to, you can create a compound string type which is length-preserving. This is what structs are for.
(Score: 2) by tangomargarine on Saturday May 09 2015, @07:31PM
Aren't zero-terminated and null-terminated usually two different things? In ASCII the number zero is stored as 32+whatever.
"Is that really true?" "I just spent the last hour telling you to think for yourself! Didn't you hear anything I said?"
(Score: 2) by tangomargarine on Saturday May 09 2015, @07:38PM
Blargh. s/number zero/character zero/g
"Is that really true?" "I just spent the last hour telling you to think for yourself! Didn't you hear anything I said?"