3 ms·
> Want undefined behaviour? C Can be solved by not doing stuff that are considered as undefined. Think of them as the standard's say of saying "don't do that".
by snakeanus 10y ago
> Want undefined behaviour? C
Can be solved by not doing stuff that are considered as undefined. Think of them as the standard's say of saying "don't do that". It's quite easy to do in most cases.
> Want segfaults? C
> Want memory corruption? C
> Want to write insecure code? C
There is absolutely nothing in C that makes it more prone to these in comparison to other languages. Moreover you can easily solve these by using an implementation that protects you. (such as one of the multiple C compilers that guarantee to produce safe code without UB or the sanitisers in gcc and clang)
> Want memory leaks? C
Can be easily avoided by avoiding dynamic memory allocation. Moreover nothing stops an implementation from using a GC.
> Want to write your own containers? C
This applies to all the languages as none of them happen to have an implementation of every container in their standard library. It is true that C lacks that in comparison to some other languages, however implementing the common ones (or using a library) is an extremely trivial thing to do.
> Want to spend 3x as much time writing code as a comparable C++ solution (not to mention more productive languages)? C
You must be quite the shitty C programmer to need 3 times less time to write something in C++.
- atilaneves 10y ago> Think of them as the standard's say of saying "don't do that" I have a list of "don't do that" rules. I still do them, usually by accident. > There is absolutely nothing in C that makes it more prone to these in comparison to other languages If you believe that, then there's nothing I can say that will change your mind. > Moreover nothing stops an implementation from using a GC Many applications can't use a GC. For tiny systems, forget it. > none of them happen to have an implementation of every container in their standard library That completely sidesteps the fact that in pretty much every other language the containers one would like to use 99% of the time are implemented in the standard library or the language itself. > You must be quite the shitty C programmer to need 3 times less time to write something in C++. Only a shitty C++ programmer _doesn't_ write code 3 times as fast as they'd write C.