Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C - C++ Learning > Re: A Question ...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 3 of 6 Topic 4115 of 4250
Post > Topic >>

Re: A Question about ##

by Ben Bacarisse <ben.usenet@[EMAIL PROTECTED] > Apr 15, 2008 at 12:40 PM

"Xiutao Yang" <xiutao.yang@[EMAIL PROTECTED]
> writes:

>    I have a program about ## ,which is the following.
<snip>

> #define F(i)   F_##i()

<snip more pre-processor mangling>

> The question is the I can call NEWW(i) in function void NEW(int i)
> But failed in processing function void FF(int i)?
> If we write void FF(int i) as:
> void FF(int i){
>     F(i);
> }
> It will fail.

That is because FF(i) expands to F_i() and there is no F_i defined.
Presumably in NEWW(i) the value of i does not matter.  You seem to
want the pre-processor (which runs once when you program is built) to
know about the value of variables at run-time.  It just can't.
 
Back up a bit and explain what you are doing and why you think this is
the right solution.

-- 
Ben.
 




 6 Posts in Topic:
A Question about ##
"Xiutao Yang" &  2008-04-15 16:05:19 
Re: A Question about ##
Ian Collins <ian-news@  2008-04-15 20:09:01 
Re: A Question about ##
Ben Bacarisse <ben.use  2008-04-15 12:40:30 
Re: A Question about ##
"Xiutao Yang" &  2008-04-15 22:55:40 
Re: A Question about ##
"Xiutao Yang" &  2008-04-15 22:57:12 
Re: A Question about ##
"Xiutao Yang" &  2008-04-15 23:02:53 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Thu Aug 28 5:33:22 CDT 2008.