@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

On Feb 4, 1:26 pm, sharad dixit <sharad.emine...@gmail.com> wrote:
> @dave i am not very much clear about your question .But i support my
> previous comment 
> widhttp://publib.boulder.ibm.com/infocenter/comphelp/v7v91/index.jsp?top...
>
>
>
>
>
> On Sat, Feb 4, 2012 at 12:25 PM, Dave <dave_and_da...@juno.com> wrote:
> > @Sharad: So what does swap(t,u,int) do?
>
> > Dave
>
> > On Feb 4, 5:10 am, sharad dixit <sharad.emine...@gmail.com> 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
> > > parameters with the arguments that you used to invoke the macro.
>
> > > The advantage of a macro is that it can be type-neutral (also
> > disadvantage
> > > sometimes ), and it is inlined directly into the code, so there is not
> >  any
> > > function call overhead.
>
> > > correct me if am wrong............ :D
>
> > > On Sat, Feb 4, 2012 at 5:32 AM, rahul sharma <rahul23111...@gmail.com
> > >wrote:
>
> > > > swap(a,b,c) c t;t=a;a=b;b=t;
>
> > > > int main()
> > > > {
> > > > int g=1,h=2;
> > > > swap(g,h,int);
> > > > }
>
> > > > how the actual values are replace???
> > > > a and b are replaced with g and h....actual are replace..can somebody
> > tell
> > > > me expanded source code???
>
> > > >  --
> > > > You received this message because you are subscribed to the Google
> > Groups
> > > > "Algorithm Geeks" group.
> > > > To post to this group, send email to algogeeks@googlegroups.com.
> > > > To unsubscribe from this group, send email to
> > > > algogeeks+unsubscr...@googlegroups.com.
> > > > For more options, visit this group at
> > > >http://groups.google.com/group/algogeeks?hl=en.
>
> > > --
> > >  Sharad Dixit
> > >  B.Tech(IT)
> > >  Indian Institute of Information Technology ,Allahabad
>
> > ---------------------------------------------------------------------------­­--------------------------------------------------
> > > "We aim above the mark to hit the mark."
> > > ~ Ralph Waldo Emerson
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Algorithm Geeks" group.
> > To post to this group, send email to algogeeks@googlegroups.com.
> > To unsubscribe from this group, send email to
> > algogeeks+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/algogeeks?hl=en.
>
> --
>  Sharad Dixit
>  B.Tech(IT)
>  Indian Institute of Information Technology ,Allahabad
> ---------------------------------------------------------------------------­--------------------------------------------------
> "We aim above the mark to hit the mark."
> ~ Ralph Waldo Emerson

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to