On Jan 6, 2008 9:32 AM, Carl-Daniel Hailfinger c-d.hailfinger.devel.2006@gmx.net wrote:
How do we factor out such code? I prefer macros for simple function wrappers and functions for multiline sequences.
I spend a lot of time with Plan 9 code nowadays. These are the Bell Labs guys who invented it all. I am (re)-learning a lot about style. The Plan 9 code is so clean and sparse, it' s a real joy to read.
I think macros are OK for bits like convenience in struct deref and such things. Spin locks and stuff like outb maybe make sense too.
I think the value of putting a one line function into a macro is over-rated. It can badly bloat the code, in unexpected ways, And, look at linux nowadays: lots of code living in .h files, making it a real headache to figure out where things get done.
So I vote for your code cleanup idea, but I'd like to see it weighed in favor of functions, unless a macro is somehow absolutely essential.
Thanks, it is a great idea, don't let me sound discouraging! The only question is, should we be really trying to apply this lesson to V3?
ron