From: Markus Armbruster <armbru@redhat.com>
To: Blue Swirl <blauwirbel@gmail.com>
Cc: qemu-devel@nongnu.org, lcapitulino@redhat.com
Subject: Re: [Qemu-devel] [PATCH 5/6] error: Link qemu-img, qemu-nbd, qemu-io with qemu-error.o
Date: Mon, 22 Mar 2010 10:37:17 +0100 [thread overview]
Message-ID: <m3634oae9e.fsf@blackfin.pond.sub.org> (raw)
In-Reply-To: <f43fc5581003181232i5c3522b7o9e39d0fd2181b86f@mail.gmail.com> (Blue Swirl's message of "Thu, 18 Mar 2010 21:32:24 +0200")
Blue Swirl <blauwirbel@gmail.com> writes:
> On 3/18/10, Markus Armbruster <armbru@redhat.com> wrote:
>> Blue Swirl <blauwirbel@gmail.com> writes:
>>
>> > On 3/18/10, Markus Armbruster <armbru@redhat.com> wrote:
>> >> Blue Swirl <blauwirbel@gmail.com> writes:
>> >>
>> >> > On 3/17/10, Markus Armbruster <armbru@redhat.com> wrote:
>> >> >> Blue Swirl <blauwirbel@gmail.com> writes:
>> >> >>
>> >> >> > On 3/17/10, Markus Armbruster <armbru@redhat.com> wrote:
>> >>
>> >> [...]
>> >>
>> >> >> >> +void monitor_set_error(Monitor *mon, QError *qerror)
>> >> >> >> +{
>> >> >> >> + assert(0);
>> >> >> >
>> >> >> > Please use abort().
>> >> >>
>> >> >>
>> >> >> Why?
>> >> >
>> >> > Because assert(0) does not abort when compiled with -DNDEBUG.
>> >>
>> >>
>> >> Why is that a problem? And why isn't it a problem for the 300+ other
>> >> assertions in the code?
>> >
>> > We didn't support -DNDEBUG build until recently. Therefore it's safe
>> > to assume that also on production builds assert(0) was equal to
>> > abort(). If the default for production builds changes to -DNDEBUG, we
>> > want to retain the same abort() behaviour.
>> >
>> > The assertions which perform debugging checks aren't a problem. But
>> > assert(0) clearly isn't a debugging check, if you ever reach this line
>> > of code, it's abort() time.
>>
>>
>> I *know* that this line cannot be reached. That's why I asserted it
>> cannot be reached.
>>
>> If you want "this can't ever happen" assertions to be checked, then you
>> shouldn't define NDEBUG.
>
> If you know for sure that this line can't be reached, why bother with
> any code at all?
>
>> Do you still want me to use abort() here?
>
> abort() or nothing at all, as you wish.
Okay, nothing it is.
>> By the way, a quick grep shows >50 uses of assert(0).
>
> Not anymore since 43dc2a645e00e6761a741e3d16c27c5b5a373b66.
I doubt the wisdom of such a wholesale conversion, but I it's hardly
worth arguing now.
next prev parent reply other threads:[~2010-03-22 9:37 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-17 17:56 [Qemu-devel] [PATCH 0/6] error: Clean up after recent changes Markus Armbruster
2010-03-17 17:56 ` [Qemu-devel] [PATCH 1/6] error: Trim includes after "Move qemu_error & friends..." Markus Armbruster
2010-03-18 21:30 ` [Qemu-devel] " Luiz Capitulino
2010-03-19 21:31 ` Markus Armbruster
2010-03-22 0:40 ` Luiz Capitulino
2010-03-22 8:38 ` Markus Armbruster
2010-03-17 17:56 ` [Qemu-devel] [PATCH 2/6] error: Trim includes in qerror.c Markus Armbruster
2010-03-18 21:32 ` [Qemu-devel] " Luiz Capitulino
2010-03-19 21:33 ` Markus Armbruster
2010-03-22 0:38 ` Luiz Capitulino
2010-03-17 17:56 ` [Qemu-devel] [PATCH 3/6] error: Trim includes after "Infrastructure to track locations..." Markus Armbruster
2010-03-17 17:56 ` [Qemu-devel] [PATCH 4/6] error: Make use of error_set_progname() optional Markus Armbruster
2010-03-17 17:56 ` [Qemu-devel] [PATCH 5/6] error: Link qemu-img, qemu-nbd, qemu-io with qemu-error.o Markus Armbruster
2010-03-17 19:53 ` Blue Swirl
2010-03-17 21:17 ` Markus Armbruster
2010-03-18 17:58 ` Blue Swirl
2010-03-18 18:09 ` Markus Armbruster
2010-03-18 18:20 ` Blue Swirl
2010-03-18 18:55 ` Markus Armbruster
2010-03-18 19:32 ` Blue Swirl
2010-03-22 9:37 ` Markus Armbruster [this message]
2010-03-17 17:56 ` [Qemu-devel] [PATCH 6/6] error: Move qerror_report() from qemu-error.[ch] to qerror.[ch] Markus Armbruster
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m3634oae9e.fsf@blackfin.pond.sub.org \
--to=armbru@redhat.com \
--cc=blauwirbel@gmail.com \
--cc=lcapitulino@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.