do { } while(0) vs if(1) { } else (was: strange loop!!)

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

 



On Monday 19 January 2004 13:48, joan@laigu.net wrote:
> Hi,
>   is answered in the FAQ. http://www.kernelnewbies.org/faq/
>
> Joan

Yes. But...
This is look like loop, but not acctualy loop. Some compilers will try to 
optimize it content by expanding some functions called in the loop (I don't 
know about gcc). This will enlarge kernel size and may have some side effects 
(for example when dealing with fix-ups). Better solution is:

#define MACRO \
	if(1) { \
		/* something */ \
	} else


--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           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