<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Nov 6, 2014 at 8:22 PM, Anton Altaparmakov <span dir="ltr">&lt;<a href="mailto:aia21@cam.ac.uk" target="_blank">aia21@cam.ac.uk</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">&gt; On 7 Nov 2014, at 01:46, Jeff Moyer &lt;<a href="mailto:jmoyer@redhat.com">jmoyer@redhat.com</a>&gt; wrote:<br>
&gt; Minor nit, but I&#39;d rather read something that looks like this:<br>
&gt;<br>
&gt;       if (type == READ &amp;&amp; (flags &amp; RWF_NONBLOCK))<br>
&gt;               return -EAGAIN;<br>
&gt;       else if (type == WRITE &amp;&amp; (flags &amp; RWF_DSYNC))<br>
&gt;               return -EINVAL;<br>
<br>
But your version is less logically efficient for the case where &quot;type == READ&quot; is true and &quot;flags &amp; RWF_NONBLOCK&quot; is false because your version then has to do the &quot;if (type == WRITE&quot; check before discovering it does not need to take that branch either, whilst the original version does not have to do such a test at all.<br></blockquote><div><br></div><div>Seriously? Just focus on the code readability/maintainability which makes the code most easily understood/obvious to a new pair of eyes, and leave such micro-optimizations to the compiler..</div><div><br></div></div>Thanks</div></div>