[algogeeks] Re: doubt about macro.......

2012-02-08 Thread Dave
@Sravanreddy001: Add curly braces... swap(a,b,c) {c t;t=a;a=b;b=t;} Dave On Feb 8, 1:28 pm, sravanreddy001 wrote: > @Dave: > > you mentioned that there is a way to fix the issue caused by calleing > swap(t,u,int) -- how can we fix this in preprocessor directive? -- You received this message b

[algogeeks] Re: doubt about macro.......

2012-02-08 Thread sravanreddy001
@Dave: you mentioned that there is a way to fix the issue caused by calleing swap(t,u,int) -- how can we fix this in preprocessor directive? -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To view this discussion on the web visit https://g

[algogeeks] Re: doubt about macro.......

2012-02-05 Thread Dave
@Sharad: Wouldn't it expand into int t; t=t;t=u;u=t with unexpected results? Also, won't swap(i,j,int) swap(x,y,double) cause trouble? It will expand into int t; t=i; i=j; j=t; double t; t=x; x=y; y=t; which gives conflicting types for t. But there is a way to fix this, isn't there? Dave O

Re: [algogeeks] Re: doubt about macro.......

2012-02-04 Thread sharad dixit
@dave i am not very much clear about your question .But i support my previous comment wid http://publib.boulder.ibm.com/infocenter/comphelp/v7v91/index.jsp?topic=%2Fcom.ibm.vacpp7a.doc%2Flanguage%2Fref%2Fclrc09cpxmac.htm On Sat, Feb 4, 2012 at 12:25 PM, Dave wrote: > @Sharad: So what does swap

[algogeeks] Re: doubt about macro.......

2012-02-04 Thread Dave
@Sharad: So what does swap(t,u,int) do? Dave On Feb 4, 5:10 am, sharad dixit wrote: > Think #define as a simple text substitution macro. > > Assume you are the preprocessor. Copy/paste the exact code for the macro > into the places where your program tried to use and then replace the macro > par