Re: [dev] [utmp][PATCH] Use same die() call in parent and child

From: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
Date: Thu, 7 Aug 2014 19:46:45 +0200

> Heyho Roberto,
>
> usually the compiler should fix this code duplication, at least with -Os set.
> So, before the patch, the code is easier to read and the compiler takes care of
> code deduplication. After the patch you save some compiler optimization time

I don't think compiler can optimize this situation. Take a look to the
original code:

        die("....", strerror(errno));
case -1:
        die("....", strerror(errno));

Compiler doesn't know that die will not return (with c11 you can
signal it with _Noreturn, but it is not this case), so it thinks
that there are two consecutive calls to die.

> versus a little longer parsing time due to a few more lines of
> code which are also less intuitive. I think we're better off
> without this one.

I already said in my previous mail that I am used to it, and for
me fallthroughs are not difficult to read, and they are very
idiomatic. Remember that readability depend of the eyes which read
;). But I have learnt something with open source code, if some
patch generates this kind of discussion then it is not a good
candidate and it is better discard it, and this is what I am
going to do with this patch.


Regards,

-- 
Roberto E. Vargas Caballero
Received on Thu Aug 07 2014 - 19:46:45 CEST

This archive was generated by hypermail 2.3.0 : Thu Aug 07 2014 - 19:48:06 CEST