4 ms·
I honestly don't mind going without C const (compared to C++ where it is more useful).
by andrewchambers 5y ago
I honestly don't mind going without C const (compared to C++ where it is more useful).
- bregma 5y ago"const" in C is like underwear. Some people are more comfortable without it but it serves a real and practical purpose and there will be times when you really appreciate its appropriate use.
- veltas 5y agoI used to use const everywhere and then one day I realised it clutters code and it's never caught a bug for me. I don't personally find it worth the extra time. (Of course, I use const with pointers on interfaces for read-only referencing).
- coliveira 5y agoAgreed. I never use const if not required (unfortunately C++ forces you to use it). It is ugly and you're doing work that should be done by the compiler. Moreover, like everything in C++, it doesn't need to be enforced, so it is mostly a moot point.