From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NrF6U-00027O-LN for qemu-devel@nongnu.org; Mon, 15 Mar 2010 14:33:26 -0400 Received: from [199.232.76.173] (port=33105 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NrF6U-00026s-5R for qemu-devel@nongnu.org; Mon, 15 Mar 2010 14:33:26 -0400 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1NrF6T-0002VO-IU for qemu-devel@nongnu.org; Mon, 15 Mar 2010 14:33:26 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55018) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NrF6T-0002VE-5o for qemu-devel@nongnu.org; Mon, 15 Mar 2010 14:33:25 -0400 Message-ID: <4B9E7D6F.4000702@redhat.com> Date: Mon, 15 Mar 2010 19:33:19 +0100 From: Paolo Bonzini MIME-Version: 1.0 References: <4B9E7A29.1020902@redhat.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: [PATCH, RFC] Replace assert(0) with abort() or cpu_abort() List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Blue Swirl Cc: Markus Armbruster , qemu-devel >> I'd consider not changing assert(0)->abort() >> if there is code after the assert that looks like an attempt at recovering. >> Example: >> >> if (!p) { >> printf ("the impossible has happened!"); >> assert (0); >> } >> >> return p->q; >> >> should be changed to abort, while >> >> if (!p) { >> printf ("the impossible has happened!"); >> assert (0); >> return 0; >> } >> >> return p->q; >> >> should not. > > Why not? According to manual page, assert(x) is equal to if (!x) abort(). > As I mentioned earlier, system emulators don't handle SIGABRT ... which won't be generated if !NDEBUG. Only if the recovery code makes sense, of course. However, my point was that those cases where there is recovery code are not no-brainers. Paolo