[Development] Disavowing the Lakos Rule for Q_ASSERT

Marc Mutz marc.mutz at qt.io
Mon Aug 26 21:59:54 CEST 2024


On 26.08.24 21:49, Thiago Macieira wrote:
> In particular, I don't see why (b) should be used at all. A precondition
> violation implies that the state was unexpected at that point. How is an
> exception going to help recovering? That sounds like an exception that would
> bubble up all the way back to main() and at best perform an emergency save of
> state. But all of that is implementable with a termination handler too.

Part of why I'm sympathetic to the assertions throw mantra is that I 
used it very successfully in Kleopatra way back when. We could easily 
take the exception's what() and report back over the UI server channel 
that an assertion happened and the client would show a message box with 
the assertion details, copyable from a QMessageBox into a bugreport. 
T'was a boon for testing.

-- 
Marc Mutz <marc.mutz at qt.io> (he/his)
Principal Software Engineer

The Qt Company
Erich-Thilo-Str. 10 12489
Berlin, Germany
www.qt.io

Geschäftsführer: Mika Pälsi, Juha Varelius, Jouni Lintunen
Sitz der Gesellschaft: Berlin,
Registergericht: Amtsgericht Charlottenburg,
HRB 144331 B



More information about the Development mailing list