10 ms·
C is easy to learn but not to reason about. First of all, C is really C + macro-C, two separate languages that don't know about each other. Second, all the damn
by LessDmesg 7y ago
C is easy to learn but not to reason about. First of all, C is really C + macro-C, two separate languages that don't know about each other. Second, all the damn UB. Third, weak typing and fourth, memory errors. So no, reasoning about C is far from easy.
- madmax96 7y agoIt is comparatively easier to reason about C than other languages that are as useful (meaning the number and quality of libraries, portability) as C.
- zik 7y agoThese arguments sound like the arguments of someone who hasn't programmed much in C. C's undefined behavior is a non-issue in almost any realistic programming situation - it would only normally crop up in cases where you're deliberately doing something strange like overflowing a variable. The typing is a non-issue if you don't do stupid things. Memory errors can be an issue but tools like valgrind make them a relatively minor hassle. None of these affect your ability to reason about C, at least not as a normal programmer.
- LessDmesg 7y ago> overflowing a variable ...can easily happen indeliberately. Just as any other exceptions. Which C can't even handle in a deterministic way because it doesn't have built-in exceptions, so you have to rely on libraries or remembering to check error codes. Not easy to reason about. > typing is a non-issue When all your function ptrs have to be cast to and from (void*) - hell yeah it's an issue. > minor hassle Then why are buffer overflow exploits in C programs on the news?
- deleted 7y ago[deleted]
- zik 7y ago> When all your function ptrs have to be cast to and from (void*) - hell yeah it's an issue. I don't know how you got this impression. This is 100% incorrect.