Hacker Newsnew | past | comments | ask | show | jobs | submit | moodguy's commentslogin

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.


Oh wow! Didn't know that. Thanks for the link!


can you give an example for the function like macro?


I really should have tested before commenting. You can't define a macro within a macro, so it doesn't work.


C,P,T are also operators that act on states | ψ>.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: