Re: generic swap()

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

 





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.

[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