- Date: Sat, 10 Mar 2018 10:53:58 +0100
- From: Albert Astals Cid <aacid@xxxxxxx>
- Subject: Re: Q_ASSERT(!FalseSecurity)
El dissabte, 10 de març de 2018, a les 10:37:12 CET, Sven Brauch va escriure:
> On 03/10/2018 09:53 AM, Michael Heidelbach wrote:
> > Am I getting something wrong? Or is
> > "Q_ASSERT(m_writeTrans);
> > m_writeTrans->commit();"
> > providing false security?
> a lot of KDE code is written this way. It will end up crashing in both
> debug and release, but in debug the message will be clearer. I think
> this makes sense for cases where you think it is very unlikely that the
> condition will not be met. I also think adding the conditional
> everywhere often makes debugging harder because it prevents the crash.
That's the important part, sure, adding an if will make it not crash, but most
probably it won't do what you wanted either.
So instead of a clear crash that you can get reported and hopefully fixed, you
get the app misbehaving but it's not so obvious to the user so you may not get
a report and it may never be fixed.