[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Questionable aspects of QEMU Error's design
From: |
Peter Maydell |
Subject: |
Re: Questionable aspects of QEMU Error's design |
Date: |
Thu, 2 Apr 2020 08:11:11 +0000 |
On Thu, 2 Apr 2020 at 07:11, Vladimir Sementsov-Ogievskiy
<address@hidden> wrote:
> Somehow, in general, especially with long function names and long parameter
> lists I prefer
>
> ret = func(..);
> if (ret < 0) {
> return ret;
> }
Personally I prefer the other approach -- this one has an extra line
in the source and
needs an extra local variable.
> Are you sure that adding a lot of boolean functions is a good idea? I somehow
> feel better with more usual int functions with -errno on failure.
>
> Bool is a good return value for functions which are boolean by nature:
> checks, is something correspond to some criteria. But for reporting an error
> I'd prefer -errno.
When would we want to return an errno? I thought the whole point of the
Error* was that that was where information about the error was returned.
If all your callsites are just going to do "if (ret < 0) { ... } then having
the functions pick an errno value to return is just extra work.
thanks
-- PMM
- Re: Questionable aspects of QEMU Error's design, (continued)
- Re: Questionable aspects of QEMU Error's design, Peter Maydell, 2020/04/01
- Re: Questionable aspects of QEMU Error's design, Vladimir Sementsov-Ogievskiy, 2020/04/02
- Re: Questionable aspects of QEMU Error's design, BALATON Zoltan, 2020/04/02
- Re: Questionable aspects of QEMU Error's design, Vladimir Sementsov-Ogievskiy, 2020/04/02
- Re: Questionable aspects of QEMU Error's design, Markus Armbruster, 2020/04/02
- Re: Questionable aspects of QEMU Error's design, BALATON Zoltan, 2020/04/02
- Re: Questionable aspects of QEMU Error's design, Markus Armbruster, 2020/04/03
Re: Questionable aspects of QEMU Error's design, Markus Armbruster, 2020/04/02
- Re: Questionable aspects of QEMU Error's design, Vladimir Sementsov-Ogievskiy, 2020/04/02
- Re: Questionable aspects of QEMU Error's design,
Peter Maydell <=
- Re: Questionable aspects of QEMU Error's design, Daniel P . Berrangé, 2020/04/02
- Re: Questionable aspects of QEMU Error's design, Markus Armbruster, 2020/04/02
- Re: Questionable aspects of QEMU Error's design, Vladimir Sementsov-Ogievskiy, 2020/04/02
- Re: Questionable aspects of QEMU Error's design, Markus Armbruster, 2020/04/02
- Re: Questionable aspects of QEMU Error's design, Vladimir Sementsov-Ogievskiy, 2020/04/02
- Re: Questionable aspects of QEMU Error's design, Markus Armbruster, 2020/04/03
Re: Questionable aspects of QEMU Error's design, Paolo Bonzini, 2020/04/02
Re: Questionable aspects of QEMU Error's design, Daniel P . Berrangé, 2020/04/02
Re: Questionable aspects of QEMU Error's design, Alex Bennée, 2020/04/02
Re: Questionable aspects of QEMU Error's design, Eric Blake, 2020/04/02