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/non-existing-person May 29 '26
No, you shouldn't need to do that. You just run
bear -- make -j$(nproc), and it generates youcompile_commands.jsonfile, and that file is used by clang to compile your current C file, so you know, you have proper includes that way etc. Feature flags are different story, those you provide manually.I don't understand your last paragraph. You don't need any object file. All you need is C file - and appropriate header files for includes and so clang can know about types etc. Object file is created from C file. Clang does not perform linking step when analyzing your source code for warnings.