Re: empty parameterized macro
- From: Hallvard B Furuseth <h.b.furuseth@xxxxxxxxxxx>
- Date: Mon, 27 Nov 2006 12:52:36 +0100
John Goche writes:
I would like to know whether there is any difference between
the macro
#define FOO
and the parameterized macro taking no parameters
#define FOO()
They are called differently. The first is called as just FOO, the
second is called as FOO(). With the second, 'FOO' without () after it
is not expanded at all. If you want to define a constant, you'll
typically define FOO. If you define something which evaluates at
run-time, it looks more informative if you define FOO().
#define FOO one
#define BAR() two
#define BAZ BAR
Now the code
FOO w BAR x BAR() y BAZ() z
expands to
one w BAR x two y two z
--
Hallvard
.
- Follow-Ups:
- Re: empty parameterized macro
- From: aegis
- Re: empty parameterized macro
- References:
- empty parameterized macro
- From: John Goche
- empty parameterized macro
- Prev by Date: Re: Reading a string of unknown size
- Next by Date: enable/disable device using device id..
- Previous by thread: empty parameterized macro
- Next by thread: Re: empty parameterized macro
- Index(es):
Relevant Pages
|