3 ms·
Any JavaScript or C# programmer will understand the ifs, elses and fors, but that doesn't mean they'll understand what the C code does or whether it's correct -
by blub 7y ago
Any JavaScript or C# programmer will understand the ifs, elses and fors, but that doesn't mean they'll understand what the C code does or whether it's correct - two essential aspects of reading code.
I've been doing C++ for more than a decade and had two tough experiences lately:
* I had to review a C project of several thousand lines. It's impossible for a human to understand if memory management is done correctly without weeks of deep analysis, so I had to resort to tools.
The logic of the code is also hard to make out because of the memory bookkeeping.
* I was reading the open source code of a Linux program and had to dig deep into a couple of system topics and read the documentation for half a dozen syscalls to make sense of it.
For me, C is one of the hardest languages to understand, you're always zoomed in at 10x, looking at all the insignificant details of memory management, working with strings and arrays, etc.
- gjulianm 7y ago> Any JavaScript or C# programmer will understand the ifs, elses and fors, I think that's what the parent comment meant with "reading (normal) C". The language itself is simple, because it only has the ifs, elses, and fors. Of course, given the simplicity of C the projects end up being complex because they have to manage a lot of things that other languages do for the programmer, but that is outside the scope of the language (i.e., you don't need to resort to the language manual to understand it). In other words, the discussion is not that everybody should be able to dive deep into C projects and instantly know what's happening, and know all syscalls and everything. The discussion is that a programmer should know what is memory management, what is a system call, etc, which is practically synonymous to being able to read normal C.
- oblio 7y agovoid strcat( char* dest, char* src ) { while (*dest) dest++; while (*dest++ = *src++); } This is pretty much C specific. And side-effect ridden, at that :-) I doubt the average Javascript programmer will figure that bit out, at a glance.