3 ms·
> goaccess is pretty neat for a C project, and it’s a demonstration why you shouldn’t use C to write complex projects Or , it's an example of how not to write
by _gabe_ 4y ago
> goaccess is pretty neat for a C project, and it’s a demonstration why you shouldn’t use C to write complex projects
Or , it's an example of how not to write a complex project in C. None of the issues the author points out are issues with C in general, they're issues with how the developers coded the project.
The only issues the author brings up are:
* They don't use the type system
* They don't use const correctness (although I'm not sure how C const differs from C++ const if it does at all)
* They use unsafe functions like strlen instead of custom string types
* They complain about the lack of container types (but that's just an issue with C in general and you'll either have to forego type safety and use ugly macros or rewrite a ton of code afaik)
* They complain about portability via #ifdefs and then complain that code paths that aren't executed aren't going to be tested (I don't know what the author is expecting here. If you have tests you can use them, but if you have no way to run the tests for platform X, but somebody added the code once upon a time, what's wrong with leaving the code and putting a note that says YMMV. Also, what does #ifdefs have to do with this? Whether platform code is locked away in a #ifdef or an abstract interface that never gets tested, it's the same problem)
* They complain about dynamic linking. But that's something you can avoid if you want by statically linking like they mention
There are plenty of good reasons to hate on C, but all of the problems listed above can (and usually are) avoided by C devs, so this feels like a hollow argument.
I was interested in hearing some of the challenges that the author ran into while trying to upgrade a C project to a modern language, but it sounds like they didn't even do that. They just complain about this particular projects dev style, which is fine, but it's not what the title says this post is about.