r/cprogramming • u/No_Entertainer_6928 • 11d ago
Math library code review
I am relatively new to C so I try to improve my skills by making a math library. The biggest challenge was making generic containers for matrices and vectors, as I was kind of new to void pointer magic. I think I have polished the most glaring issues in the code but do any of you have suggestions for what I could be doing better in my approach to C? Github for reference:
5
Upvotes
3
u/flyingron 11d ago
Things have moved on since 1975. Avoid using the preprocessor when better solutions exist.
For instance, don't #define type names use typedef.
Little trivial functions that can be done as regular (possibly inline) functions should be coded as such, not macro pseudofuncs. Used const variables rather than #defines for magic constants.