On Sonntag, 17. Dezember 2017 19:43:11 CET Robert C. Helling wrote: > Hi, > > > Am 17.12.2017 um 19:11 schrieb Dirk Hohndel <[email protected]>: > >> On Dec 17, 2017, at 8:06 AM, Robert Helling <[email protected]> wrote: > >> > >> Hi, > >> > >>> On 17. Dec 2017, at 14:19, Berthold Stoeger <[email protected]> > >>> wrote: > >>> > >>> There is another warning concerning entry in l.807. To make the warning > >>> go > >>> away, you could add a > >>> > >>> if (pi->nr <= 0) > >>> > >>> return; > >>> > >>> block before the loop. Even if pi->nr can never be <= 0, this seems like > >>> a > >>> good idea for robustness' sake. > >> > >> isn’t that what > >> > >> assert(pi->nr >= 0); > >> > >> is for? > > > > Asserts are usually compiled out in production code. Not a huge fan of > > asserts, TBH > But they do not just fail silently in debug mode as does if-return. If this > occurs it‘s a bug that needs to be taken care of.
I'd say it depends on how big a disaster `pi->nr <= 0` is. If it can be recovered from, a compromise could be qWarning(...) + return: Developers are informed, user doesn't loose data owing to crash and compiler is happy. Berthold _______________________________________________ subsurface mailing list [email protected] http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface
