Hi

On Mon, Nov 3, 2014 at 1:50 PM, Lennart Poettering
<[email protected]> wrote:
> On Mon, 03.11.14 13:46, David Herrmann ([email protected]) wrote:
>
>> static inline int negative_errno(void) {
>>         assert_return(errno > 0, -EINVAL);
>>         return -errno;
>> }
>
> Looks great to me!
>
> But please add a comment next to it, explaining why to use this. I
> mean, we should really clarify that "return -errno" is usually enough,
> and "return negative_errno()" is really just about making gcc shut up,
> and should not be used for cases unlike the one you ran into.

I pushed this now. It's probably only useful for constructors, as they
don't clear the output-parameters on failure. If the return-value is
the only output-argument, there's usually no need to use it.

Thanks
David
_______________________________________________
systemd-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to