HNHacker News
TopNewBestAskShowJobs

moodguy

61 karma · joined October 13, 2021

submissionscomments
moodguy··on My personal C coding style as of late 2023
For my hobby projects i do the following.

I adopted the style of writing all macros in lower case with the prefix "macro_", so i can grep through all macros. So macro_ becomes like a keyword. Same with enum.

I use almost the same naming scheme for i32,f32, etc., but i typedef for example size_t const to usz, and size_t to usz_ (or use macro mut(x) x ## _) . So all shorter type names are const by default. I use a single header of 35 sloc to do that.

I see that this way of coding can be confusing for other people, so i avoid it when writing code that other people have to work with. But for personal code its really enjoyable for me.

moodguy··on Lisp C Compiler, Lisp-like syntax for writing C code
Oh wow! Didn't know that. Thanks for the link!
moodguy··on A header-only C implementation of C++ <algorithm>
can you give an example for the function like macro?
moodguy··on Scientists Say There May Be a Mirror Universe in Which Time Runs Backwards
C,P,T are also operators that act on states | ψ>.