Subject: Re: c-style question
To: Matt Thomas <matt@3am-software.com>
From: Simon Burge <simonb@wasabisystems.com>
List: tech-kern
Date: 11/19/2001 16:45:33
Matt Thomas wrote:
> At 03:13 PM 11/19/2001 +1100, Simon Burge wrote:
> >Hi,
> >
> >In KNF, do we prefer either
> >
> > (*platform.cons_init)();
> >or
> > platform.cons_init();
> >
> >when cons_init is a function pointer?
>
> I prefer the former since it makes it explicit that you are calling
> a function pointer.
Aesthetically speaking, I prefer the later :-) It just looks a little
less like line noise (to me)...
> >Related is why in the above example we get an error in the later case
> >but not the former. "cons_init" is a macro in <dev/cons.h>, but for
> >some reason it doesn't get expanded in the first case. Any clue sticks
> >available for something simple I might have overlooked?
>
> I bet cons_init is defined as cons_init() which won't be expanded
> on just a plain cons_init reference (the first case).
Sure enough....
Simon.
--
Simon Burge <simonb@wasabisystems.com>
NetBSD CDs, Support and Service: http://www.wasabisystems.com/