3 ms·
It is irresponsible to the point of professional negligence to write new software in C.
by sagichmal 7y ago
It is irresponsible to the point of professional negligence to write new software in C.
- drocer88 7y agoIsn't C the fastest, most energy efficient and has a very small code footprint? see : https://thenewstack.io/which-programming-languages-use-the-least-electricity/ https://thenewstack.io/which-programming-languages-use-the-l... You'd think that something like a text search would benefit from being as fast as possible. Aren't most of the other languages written in C because it is fast? (Except for Rust, of course, which now appears to be a very reasonable alternative ).
- sagichmal 7y agoC is fast, small, and energy efficient. It is also impossible to write safe, exploit-free code in C by hand. The juice ain’t worth the squeeze.
- ph33t 7y agoIt is more irresponsible to make a comment like this. People should write software in a language that A) can do the job B) they're proficient in. For example, I would much rather have a C program written by someone proficient in C than a C# program written by someone new to the language.
- sagichmal 7y agoThe point I’m making is that nobody is actually proficient in C; it’s not possible to write safe software in it.
- Too 7y agoYep, not to bash the author but just to show how easy it is to write unsafe C. First function i started reading i already found a memory leak within a minute: indexer calls dsplit which calls dcreatea which calls malloc, this value is never freed inside indexer or anywhere on the way down. It might be that the buffer gets shared with index so by coincidence it's eventually freed but the fact that i have to think so hard and juggle all those buffers in my head for such a simple function just makes my head hurt. dsplit(), an even simpler function also calls dcreate() which allocates memory into the variable called 'new' that never gets freed. This is schoolbook example of a memory leak, showing the guy didn't choose C because he's already proficient in it. Or even worse, if he is proficient and the language still allows such serious mistakes to slip through so easily. Edit: the code is actually completely full of memory leaks the more i read, stuff like else if(dequals(commands.values[0], dcreate(SEARCH))) where dcreate returns a buffer from malloc which would have to be freed.