'static inline' vs macros for kernel functions ? (was how to
handle name clashes in linux/freebsd kernel sources ?)
jhb at freebsd.org
Tue Jun 26 20:31:29 UTC 2007
On Tuesday 26 June 2007 03:31:30 pm Luigi Rizzo wrote:
> This is related to the post attached at the end of this email.
> In this commit:
> CVS log for src/sys/sys/systm.h
> Revision 1.252: download - view: text, markup, annotated - select for
> Fri Mar 9 22:41:01 2007 UTC (3 months, 2 weeks ago) by jhb
> msleep() changed from a function to a macro wrapping _sleep().
> Being a macro, it is a lot harder to hide it in case of name clashes
> such as the one mentioned below.
> This raises the question - what is the point in using macros
> in cases like this where we could use static inline function and
> probably even exploit better compiler checks ?
> Would it be possible to revert msleep() to a real function ?
FreeBSD already uses macros all over the place in sys/*.h. Go duke it out
with bde at . :) You can always #undef msleep and redefine it to something
More information about the freebsd-current