[Development] What's the status of a moved-from object?

André Pönitz apoenitz at t-online.de
Mon May 20 23:30:52 CEST 2019


On Mon, May 20, 2019 at 11:58:49PM +0300, Konstantin Shegunov wrote:
> I agree as well, although I have a minor nitpick. Q_ASSERT works only if it
> was not stripped while building Qt. Meaning that I'm often working, as I'm
> sure other users, on Linux especially, with the default (i.e. release)
> version of Qt from the repo. Granted it may be my own fault, but in this
> case the assert isn't tripped and this code simply segfaults for reasons
> that aren't so obvious. Any suggestions how to mitigate that?

Use your own fallback code that does what you want.

If yoy drive the Mars Rover and have a backup system that can take over
when you fail, signalling your failure early and decisively might be the
way to go (and yes, Q_ASSERT doesn't help in that case).

If you are the only one around, you are the master of ceremony, and
"The Show Must Go On", then doing "something" (logging, returning 
something likely/not completely broken) might be the only way out
(and yes, Q_ASSERT doesn't help in that case either).

> Somehow  *suggest* to the user that [s]he's supposed to build in
> debug mode otherwise they're on their own?

Nobody forces you to use Q_ASSERT.

Andre'



More information about the Development mailing list