From: "Marius Cosma" <marius.cosma@computaris.com>
To: linux-c-programming@vger.kernel.org
Subject: RE: Macro exercise
Date: Fri, 18 Aug 2006 12:19:52 +0300 [thread overview]
Message-ID: <01b701c6c2a7$76c33770$b361a8c0@COSMA> (raw)
In-Reply-To: <01b501c6c2a6$62fdfcd0$b361a8c0@COSMA>
Solved ... x.PARAM works just fine
-----Original Message-----
From: linux-c-programming-owner@vger.kernel.org
[mailto:linux-c-programming-owner@vger.kernel.org] On Behalf Of Marius Cosma
Sent: 18 August 2006 12:12
To: linux-c-programming@vger.kernel.org
Subject: RE: Macro exercise
Hello,
I want to use a macro for a structure member, something like:
typedef struct {
int a;
int b;
int c;
} myStruct;
myStruct x;
x.a = 7;
x.b = 8;
x.c = 9;
#undef PARAM
#define PARAM a
printf("x=%d\n", x.##PARAM);
#undef PARAM
#define PARAM b
printf("x=%d\n", x.##PARAM);
#undef PARAM
#define PARAM c
printf("x=%d\n", x.##PARAM);
But I'm having problems in writing it correct (that "x.##PARAM"). Are you
faster than a google search? :)
Thanks
This email is subject to Computaris email terms of use:
http://www.computaris.com/email_terms.html
-
To unsubscribe from this list: send the line "unsubscribe
linux-c-programming" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
This email is subject to Computaris email terms of use: http://www.computaris.com/email_terms.html
prev parent reply other threads:[~2006-08-18 9:19 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-08-18 9:12 Macro exercise Marius Cosma
2006-08-18 9:19 ` Marius Cosma [this message]
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='01b701c6c2a7$76c33770$b361a8c0@COSMA' \
--to=marius.cosma@computaris.com \
--cc=linux-c-programming@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.