Re: generic swap()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 1/21/09, debian developer <debiandev@xxxxxxxxx> wrote:
>
>
> On Wed, Jan 21, 2009 at 1:13 PM, Fernando Apesteguía
> <fernando.apesteguia@xxxxxxxxx> wrote:
> >
> > On 1/21/09, debian developer <debiandev@xxxxxxxxx> wrote:
> > > I don't seem to understand this patch. What is swap(a, b) returning
> here?
> > > and where is it returning from?
> >
> > It is not "returning" but substituting, cause it's a macro, not a
> > function. It swaps the values of "a" and "b".
> >
> >
> >
> >
> >
> > > > > > The reason I ask it that I wonder why swap() has a return value?
> >
>
> ^^^^^^^^^^^^^^^^ that was the reason I asked where it is returning :)
>
> With a macro without do-while:
>
> if(condition)
>   swap(a, b)
>
> will be
>
> if(condition)
> ({
> ...;
> ...;
> }
> )
>
> I still see all the lines being executed in case the condition is true.

Yep, absolutely right (I missed the parenthesis). Coding style? I've
seen this macros protected by do-while structures but not usually with
"({ ... })".

About the other thing, I don't see the "accident" they mention
above... anybody sees it?

>

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux