* QUESTION: kernel/drivers/char/console_macros.h
@ 2005-05-17 10:00 cutaway
0 siblings, 0 replies; only message in thread
From: cutaway @ 2005-05-17 10:00 UTC (permalink / raw)
To: linux-console
#define vc_state ....
This particular macro happens to be the SAME NAME as the vconsole data
structure member it references.
This seems quite unhandy if you try to reference the vc_state member using a
pointer to a vconsole data structure like so:
struct vc_data *vcdp = vc_cons[currcons].d;
vcdp->vc_state = whatever...;
The macro will expand (because of course it has the same name and the
preprocessor doesn't know the difference) when what you really wanted was
the structure member. Cryptic syntax errors result.
So... HERE IS THE QUESTION: was there some compelling reason this particular
macro should be this way, (rather than #define state ...) or was it just
some ages old typo that was never noticed?
Of course, if all you use is the macros to reference vconsole data, the
issue never surfaces - but the resultant code quality suffers when some
function has several macros in it that could benefit from caching a pointer
to the current vcon structure and using that.
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2005-05-17 10:00 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-05-17 10:00 QUESTION: kernel/drivers/char/console_macros.h cutaway
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).