linux-console.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: <cutaway@bellsouth.net>
To: linux-console@vger.kernel.org
Subject: QUESTION:  kernel/drivers/char/console_macros.h
Date: Tue, 17 May 2005 06:00:11 -0400	[thread overview]
Message-ID: <000b01c55ac7$3a1e8e80$2800000a@pc365dualp2> (raw)

#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.


                 reply	other threads:[~2005-05-17 10:00 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='000b01c55ac7$3a1e8e80$2800000a@pc365dualp2' \
    --to=cutaway@bellsouth.net \
    --cc=linux-console@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).