<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Dec 13, 2012 at 10:55 AM, Shraddha Kamat <span dir="ltr"><<a href="mailto:sh2008ka@gmail.com" target="_blank">sh2008ka@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">I notice<br>
<br>
do {<br>
// do something 1 ;<br>
// do something 2 ;<br>
...<br>
} while (0);<br>
<br>
being used everywhere in the kernel code<br>
I just can't guess of any use of this other<br>
than executing couple of C statements together ?<br>
<br>
Is there any special purpose of doing this ??<br>
Sorry of such a silly question - I am just trying<br>
to learn kernel hacking basics.<br>
<br>
-- Shraddha<br>
<br>
<br>
_______________________________________________<br>
Kernelnewbies mailing list<br>
<a href="mailto:Kernelnewbies@kernelnewbies.org">Kernelnewbies@kernelnewbies.org</a><br>
<a href="http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies" target="_blank">http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies</a></blockquote><div> </div></div><a href="http://stackoverflow.com/questions/257418/do-while-0-what-is-it-good-for">http://stackoverflow.com/questions/257418/do-while-0-what-is-it-good-for</a><br>
<br>This link gives you a pretty good answer.</div><div class="gmail_extra">The basic rational behind using such a construct is when you want to a define a multi-line macro.</div></div>