Re: plz analyze the o/p ?

From: xarax (xarax_at_email.com)
Date: 08/01/04


Date: Sun, 01 Aug 2004 14:51:02 GMT


"Emmanuel Delahaye" <emdel@YOURBRAnoos.fr> wrote in message
news:mn.0a5b7d48f267b482.15512@YOURBRAnoos.fr...
> Till Crueger wrote on 01/08/04 :
> > wouldn't this work even better
> >
> > #define SWAP(a, b, type) \
> > do { \
> > type temp = (a); \
> > (a) = (b); \
> > (b) = temp; \
> > } while (0)
> >
> > It expands correctely on my compiler, but should it?
>
> Yes, this is probably the most versatile and safe solution.

Unless "temp" is a conflicting name in an outer scope.
I would prefer passing just the type name.

-- 
----------------------------
Jeffrey D. Smith
Farsight Systems Corporation
24 BURLINGTON DRIVE
LONGMONT, CO 80501-6906
http://www.farsight-systems.com
z/Debug debugs your Systems/C programs running on IBM z/OS for FREE!


Relevant Pages

  • Re: char (*ptr)[]
    ... Emmanuel Delahaye wrote: ... >> Does your compiler accept this declaration? ... >> dimension is required. ...
    (comp.lang.c)
  • Re: char (*ptr)[]
    ... Emmanuel Delahaye wrote: ... >> Does your compiler accept this declaration? ... >> dimension is required. ...
    (comp.lang.c)