On Mon, Jun 01, 2015 at 05:06:56PM +0200, Tom Gundersen wrote:
> > -                (void) 
> > sd_event_source_set_description(m->mount_utab_event_source, 
> > "mount-utab-dispatch");
> > +                sd_event_source_set_description(m->mount_event_source, 
> > "mount-monitor-dispatch");
> 
> This should be cast to (void) unless you check the return.

Frankly, I don't like it. It's old-style programming garbage. For
compiler it's probably irrelevant construction and for developers
(code readers) we have better things like warn_unused_result.

I have removed many of these (void) from util-linux and nobody
complains. 
 
If you really want to force people to check return code than mark 
function by warn_unused_result and if you still want to ignore the
result for these functions in some situations then you can use
something like:

# define ignore_result(x) __extension__ ({ \
        __typeof__(x) __dummy __attribute__((__unused__)) = (x);
        (void) __dummy; \
})


the result is more readable and obvious:

   ignore_result( sd_event_source_set_description(foo, bar ) );


Sometimes we use this macro to keep silent some crazy glibc functions.


Anyway, if (void) is really systemd coding style then I'm going to
update the patch. No problem ;-)

    Karel

-- 
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com
_______________________________________________
systemd-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to