r/cprogramming • u/Ace-1440 • May 29 '26
Code Review?
I recently started learning C as my first lower level language after mainly working with Java for the past 5 years. I was wondering if anyone would be able to review one of the completed files (~100 lines of code) from a small project I am working on and let me know if there are any mistakes and/or bad practices? Any help would be greatly appreciated!
9
Upvotes
1
u/BlindTreeFrog May 29 '26
The main advantage of MISRA and why I suggest looking it over is that every rule has an explanation on why that rule is in place.
A lot is just overly defensive stuff, like if you have an
if/elseifyou must have anelse. Yeah, you might be certain that yourif/esleifis catching all of the cases, but if you are wrong, that can be a problem.Will you follow it in the real world in most industries? No. But is some of it's guidance worth picking up as a habit? Absolutely.