Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #18744

Re: macro chain

From Ian Collins <ian-news@hotmail.com>
Newsgroups comp.lang.c
Subject Re: macro chain
Date 2012-03-14 17:59 +1300
Message-ID <9samt6F8igU5@mid.individual.net> (permalink)
References <b2008229-ce07-4b57-b337-640b422d2dda@a20g2000yql.googlegroups.com> <4f6024ec$0$1379$4fafbaef@reader2.news.tin.it>

Show all headers | View raw


On 03/14/12 06:00 PM, io_x wrote:
> "luser- -droog"<mijoryx@yahoo.com>  ha scritto nel messaggio
> news:b2008229-ce07-4b57-b337-640b422d2dda@a20g2000yql.googlegroups.com...
>> I remember reading something from Knuth to the effect that you don't
>> really need multiple argument macros because you can yield a macro
>> name from the macro expansion and call that with a new argument.
>>
>> So I tried a little experiment:
>>
>> #define A(x) x + B
>> #define B(y) y y y
>> A(2)(3)
>>
>> And I'll be darned if gcc -E doesn't produce:
>>
>> 2 + 3 3 3
>>
>> But I'm not really doing this right, am I? Does anyone have
>> suggestions for where I could learn more? (more Knuth?)
>
> better not use C macro if not in these case:
> #define   whatIsThisNumber  89
> #define   B                 73
> #define   u32    unsigned int
> #define   R      return

No!


-- 
Ian Collins

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

macro chain luser- -droog <mijoryx@yahoo.com> - 2012-03-13 21:47 -0700
  Re: macro chain "io_x" <a@b.c.invalid> - 2012-03-14 06:00 +0100
    Re: macro chain Ian Collins <ian-news@hotmail.com> - 2012-03-14 17:59 +1300
    Re: macro chain "io_x" <a@b.c.invalid> - 2012-03-14 06:25 +0100
  Re: macro chain Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-03-14 12:54 +0000
  Re: macro chain Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-03-14 09:05 -0400
    Re: macro chain luser- -droog <mijoryx@yahoo.com> - 2012-03-14 08:56 -0700

csiph-web