cvs commit: src/sys/amd64/isa atpic.c src/sys/contrib/dev/oltr if_oltr.c src/sys/dev/aac aac_pci.c src/sys/dev/acpic

Alexey Dokuchaev danfe at nsu.ru
Tue Mar 23 09:31:40 PST 2004


On Tue, Mar 23, 2004 at 10:24:16AM -0700, M. Warner Losh wrote:
> In message: <20040323130235.GB39851 at regency.nsu.ru>
>             Alexey Dokuchaev <danfe at nsu.ru> writes:
> : On Mon, Mar 22, 2004 at 11:15:42AM -0800, Bill Paul wrote:
> : > 
> : > This is the entire bus_alloc_resource_any() function:
> : > 
> : > static __inline struct resource *
> : > bus_alloc_resource_any(device_t dev, int type, int *rid, u_int flags)
> : > {
> : >         return (bus_alloc_resource(dev, type, rid, 0ul, ~0ul, 1, flags));
> : > }
> : > 
> : > Please to be explaining why this isn't a macro:
> : > 
> : > #define bus_alloc_resource_any(dev, type, rid, flags)	\
> : > 	bus_alloc_resource(dev, type, rid, 0ul, ~0ul, 1, flags)
> : 
> : Pardon my sneaking in discussion, but I also wonder why isn't this a
> : macro?  I probably should blame myself for not looking at the actual
> : diff when I received your commit message, but I was pretty sure that
> : you've just added a macro like Bill suggested above.
> 
> As has been explained, macros are less safe than inlines.  The above
> implementation suffers from a lack of (), for example.  gcc and most
> other modern compilers generate identical code in both these cases and
> the inline gives a scoping that the macro does not.

Thanks, I should probably read all my cvs-all@ mail before replying to
the earliest ones.

./danfe


More information about the cvs-all mailing list