[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [PATCH] aufs: Do not refer to AUFS_NAME in pr_fmt

Geert Uytterhoeven dixit:

>Sorry, static inline functions are preferred over macros, unless there's

Can I have reasons? (Also out of curiosity.)

>a really good reason. Out-of-tree kernel code doing stupid things doesn't

I see it like this:

EVERY file that, directly or indirectly, includes hardirq.h has the
overhead of having GCC compile that static inline function, even if
it’s never used (and thus never emitted into the object file). Also,
redefining pr_fmt appears to be a desired thing, not a stupid thing;
if a static inline function uses pr_fmt in the timeframe between it
being redefined and the redefined one’s prerequisites being availab-
le, it would necessarily fail.

In contrast to that, a cpp macro is only evaluated when it’s actual-
ly needed, and by then, the prerequisites would probably be availab-
le. It also has less compile-time overhead (in this case, since the
hardirq.h file is probably included in more files than it is needed,
whereas macros slow down when you use them more than once in all fi-
les they’re defined in.

Sometimes they [people] care too much: pretty printers [and syntax highligh-
ting, d.A.] mechanically produce pretty output that accentuates irrelevant
detail in the program, which is as sensible as putting all the prepositions
in English text in bold font.	-- Rob Pike in "Notes on Programming in C"

Reply to: