Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > passes of the Preprocessor //

Reply
Thread Tools

passes of the Preprocessor //

 
 
onkar
Guest
Posts: n/a
 
      11-30-2006
#include<stdio.h>
#define string(x) #x
#define replace(x) string(x)
#define var Hello
int main(int argc,char **argv){
char *str=replace(var);
printf("%s\n",str);
return 0;
}

This will print :
Hello

Ok fine , but can any one explain me how the preprocessor does it ?? In
one pass on multiple passes .The answer will be invaluabe to me.

regards,
Onkar

 
Reply With Quote
 
 
 
 
Keith Thompson
Guest
Posts: n/a
 
      11-30-2006
"onkar" <(E-Mail Removed)> writes:
> #include<stdio.h>
> #define string(x) #x
> #define replace(x) string(x)
> #define var Hello
> int main(int argc,char **argv){
> char *str=replace(var);
> printf("%s\n",str);
> return 0;
> }
>
> This will print :
> Hello
>
> Ok fine , but can any one explain me how the preprocessor does it ?? In
> one pass on multiple passes .The answer will be invaluabe to me.


As far as I know, most preprocessors work in one pass, but why does it
matter? It works as defined by the standard (if it's not buggy); what
more do you really need to know?

(There's certainly nothing wrong with curiosity, but you said the
answer will be invaluable.)

--
Keith Thompson (The_Other_Keith) http://www.velocityreviews.com/forums/(E-Mail Removed) <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
 
Reply With Quote
 
 
 
 
raxitsheth2000@yahoo.co.in
Guest
Posts: n/a
 
      11-30-2006
if you are using gcc, then there is -E option that will only Stop after
Pre-Comilation.
after that you can view the output file.


--raxit
onkar wrote:
> #include<stdio.h>
> #define string(x) #x
> #define replace(x) string(x)
> #define var Hello
> int main(int argc,char **argv){
> char *str=replace(var);
> printf("%s\n",str);
> return 0;
> }
>
> This will print :
> Hello
>
> Ok fine , but can any one explain me how the preprocessor does it ?? In
> one pass on multiple passes .The answer will be invaluabe to me.
>
> regards,
> Onkar


 
Reply With Quote
 
Richard Heathfield
Guest
Posts: n/a
 
      11-30-2006
onkar said:

> #include<stdio.h>
> #define string(x) #x
> #define replace(x) string(x)
> #define var Hello
> int main(int argc,char **argv){
> char *str=replace(var);
> printf("%s\n",str);
> return 0;
> }
>
> This will print :
> Hello
>
> Ok fine , but can any one explain me how the preprocessor does it ?? In
> one pass on multiple passes .The answer will be invaluabe to me.


http://c-faq.com Answer 11:17 explains this.

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at the above domain, - www.
 
Reply With Quote
 
CBFalconer
Guest
Posts: n/a
 
      11-30-2006
(E-Mail Removed) wrote:
>
> if you are using gcc, then there is -E option that will only Stop
> after Pre-Comilation. after that you can view the output file.


Don't top-post. See the following links.

--
Some informative links:
<news:news.announce.newusers
<http://www.geocities.com/nnqweb/>
<http://www.catb.org/~esr/faqs/smart-questions.html>
<http://www.caliburn.nl/topposting.html>
<http://www.netmeister.org/news/learn2quote.html>
<http://cfaj.freeshell.org/google/>


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cisco VPN Client connects but no traffic passes through. Mephesto Cisco 0 06-24-2005 04:24 PM
Compiler error occurred when try to use a flexible template expression in preprocessor definesCompiler error occurred when try to use a flexible template expression in preprocessor defines snnn C++ 6 03-14-2005 04:09 PM
Pix VPN: one network passes ok, other doesn't! paul blitz Cisco 4 10-22-2004 08:12 AM
Split Tunnel Blocks http through tunnel but passes http around tunnel a.nonny mouse Cisco 2 09-19-2004 12:10 AM
preprocessor, token concatenation, no valid preprocessor token Cronus C++ 1 07-14-2004 11:10 PM



Advertisments