3 ms·
It seems to use c99, I would like to know from folks who have read this book, for learning newer features in C, what do you recommend? Also, does this book als
by potato-peeler 1y ago
It seems to use c99, I would like to know from folks who have read this book, for learning newer features in C, what do you recommend?
Also, does this book also teach some of the pitfalls of stdlib like gets or scanf?
Basically I always read in HN/lobsters/other forums that modern C is just as safe as newer languages but I don’t see much book or tutorials teaching modern concepts or even industry standards like Misra?
- atiedebee 1y ago> Basically I always read in HN/lobsters/other forums that modern C is just as safe as newer languages This is absolutely false. Modern C++ might get close (although I am not too familiar with it) but C has not gotten much safer over the years (one might argue it got even less safe due to threads being added in C11). As for learning about modern versions of C: you can read cppreference[0] which has fairly accurate information on the standard. Not much has been added over the years and C17 is merely a minor correction, so there has really only been 2 new versions since C99. [0]: https://en.cppreference.com/w/c.html https://en.cppreference.com/w/c.html
- potato-peeler 1y agoI specifically mentioned Misra standards for writing safe C. And ensuring thread safety is not just a C Lang pitfall. I was not looking for language reference rather how current software written in C ensure memory safety. How do their development paradigm look like? Teaching both the software pitfalls in C and how to mitigate them, maybe by giving examples from modern software or standards like Misra, will really help someone to understand how to write better C. Just linking a language reference does not help.
- atiedebee 1y agoI misunderstood the question then, since I thought it was about learning about the newer language features. C coding standards differ quite a lot, and unfortunately I can't point out any software that has standards developed for safety. As to still try and be helpful: I've enjoyed reading nullprograms blog[0] where he looks into interesting ways to make C more useable (although he tends to replace the entire standard library for reasons highlighted here[1]) There is some must avoid functions (mostly string functions) and a good list of them has been compiled in the git project repository[2]. I've tried looking up the misra C guidelines but they were hard to find or (if I remember correctly) had to be paid for or something like that [0] https://nullprogram.com https://nullprogram.com [1] https://nullprogram.com/blog/2023/02/11/ https://nullprogram.com/blog/2023/02/11/ [2] https://github.com/git/git/blob/master/banned.h https://github.com/git/git/blob/master/banned.h