My personal C coding style as of late 2023
nullprogram.com
My personal C coding style as of late 2023
1–10 of 466 posts
Re: My personal C coding style as of late 2023
#2Re: My personal C coding style as of late 2023
#3Re: My personal C coding style as of late 2023
#4[flagged]
Re: My personal C coding style as of late 2023
#5[flagged]
Re: My personal C coding style as of late 2023
#6Technically, it's illegal to #define over a language keyword.
Re: My personal C coding style as of late 2023
#7I’ve started writing a bare metal OS for Arm64. It’s very early but I’ve done some similar things. I’m using pascal strings, I’ve also renamed the types (though I’m using “int8” style, not “i8”).
I quickly decided that I never intend to port real software to it, so I really don’t have to conform to standard C library functions or conventions. That’s given me more freedom to play around. C is old enough to have a lot of baggage from when every byte was precious, even in function names.
It’s nice to get away from that. Much like the contents of this post, that plus other small renamed just ended up feeling like a nice cleanup.
Re: My personal C coding style as of late 2023
#8Re: My personal C coding style as of late 2023
#9Maybe I'm a beginner then. He lists a few cases where it's not worse than sticking to 8-bit bools, but no cases where it's actually an improvement. It still wastes memory sometimes, e.g. if you have adjacent booleans in a struct, or boolean variables in a function that spill out of registers onto the stack. Sure it's only a few bytes here and there, but why pessimize? What do you gain from using a larger size?