Greeting Hackers,
I recently acquired a very uncommon PlayStation 1 devkit and I've set about a personal sidequest to write a _very basic_ PSOne game.
I've started by prototyping in JavaScript/canvas and am now porting it to C/SDL. Once that's done I aim to port the C code to use the PSX C SDKs.
As well as hobbyism, I'm doing this to understand C better and at least grasp the practices of C programmers, even if I end up seldom writing C myself.
With that out of the way, what practices are good to internalise working in a C project?
- What footguns do you often see beginners trip over?
- Do you use prefixes like g_ or p_ for globals / pointers?
- What's your "approach" to modularisation in C? Do you prefix non-static function names to mark them as being part of a package?
- What are your preferred patterns for ensuring all allocations are eventually freed?
- What IDEs do people use for hobbyist C projects? Right now I am editing in VSCode, which is okay, but a little limited
- Will I be "okay" in the real world using more "recent" C features like VLAs? Or are these typically proscribed?
- Does it generally matter how I do error handling, so long as it isn't setjmp / longjmp?
- Are there any tools that will help me avoid many footguns or UB? I am compiling with -Wall -Wextra -Wpedantic, and using "leaks" on MacOS.
Any advice from C programmers new or seasoned is a help!
I recently acquired a very uncommon PlayStation 1 devkit and I've set about a personal sidequest to write a _very basic_ PSOne game.
I've started by prototyping in JavaScript/canvas and am now porting it to C/SDL. Once that's done I aim to port the C code to use the PSX C SDKs.
As well as hobbyism, I'm doing this to understand C better and at least grasp the practices of C programmers, even if I end up seldom writing C myself.
With that out of the way, what practices are good to internalise working in a C project?
- What footguns do you often see beginners trip over?
- Do you use prefixes like g_ or p_ for globals / pointers?
- What's your "approach" to modularisation in C? Do you prefix non-static function names to mark them as being part of a package?
- What are your preferred patterns for ensuring all allocations are eventually freed?
- What IDEs do people use for hobbyist C projects? Right now I am editing in VSCode, which is okay, but a little limited
- Will I be "okay" in the real world using more "recent" C features like VLAs? Or are these typically proscribed?
- Does it generally matter how I do error handling, so long as it isn't setjmp / longjmp?
- Are there any tools that will help me avoid many footguns or UB? I am compiling with -Wall -Wextra -Wpedantic, and using "leaks" on MacOS.
Any advice from C programmers new or seasoned is a help!