2 ms·
I think one of the interesting things about C is that if you ask 100 C devs the “right way” you’ll have 100 ways! :-) C allows you tons of freedom to make prog
by _benj 3y ago
I think one of the interesting things about C is that if you ask 100 C devs the “right way” you’ll have 100 ways! :-)
C allows you tons of freedom to make programs your own. As you also use libraries you’ll see various approaches and conventions. For example SDL use SDL_FuntionName() while something like Cairo uses cairo_function_name()
I totally hear you because those same questions about “best practices” were the ones I had when I started C. C is and incredibly powerful tool that lets you almost anything! So, just enjoy the ride and let your taste develop as you go!
I personally use all standard ints so uint8_t instead of unsigned char. I also like namespacing stuff, like the functions in my_library.h would have something like ml_function_one() and ml_function_two().
I’ve also come to appreciate immensely macros! Sure, they can be as dangerous and as useful as a very sharp Japanese Damascus steel knife in the kitchen, use your discretion ;-)
But above all, have fun! C puts almost no limits on you and soon you’ll find yourself passing function pointers, making system calls and playing with memory as if it was nothing!
Have fun!