Hello, still trying to learn a bit the code. Compiling without DEBUG on gives some new warnings:- ) This lead me to look at some code construct. Here is in pseudo-code a typical construct I am crossing:
var y = ....; var x = ....; code if ( y > MAXVALUE) { ASSERT(x, "out of range"); // only use of var x is here } // there is no else statement code Looking at easy hacks, I also saw that ASSERT is deprecated. I have looked at the OSL macros, but did not found an equivalent of ASSERT(condition, message) (defined in filters/binfilter/inc/bf_sw/errhdl.hxx But further, this is not very useful for the end-user, since LibO is shipped without debug-level on. (right? ) So I was thinking: * either a macro exists to do a "hello user, I will crash. Thanks to send this report", that is added within the if statement. ?? * or to change the code to something like: var y = ...; #if OSL_DEBUG_LEVEL > 0 var x = ...; /* if this is not possible to insert x below, and the initialization of x does not change any state */ #endif code #if OSL_DEBUG_LEVEL > 0 if ( y > MAXVALUE) { ASSERT(x, "txt"); // only use of var x is here } // there is no else statement #endif code to avoid shipping unneeded code to end-user. This will also make code execution more efficient, avoiding dummy branches. By the way: what is the right way to achieve the goal of the easy hack : align ASSERT (& friends) macro foo ? include /ure/sal/inc/osl/diagnose.h in file, and use only OSL_Debug macros loosing all messages? Is it possible to add an additional OSL_ASSERT(condition, message) macro? Or not wanted? Thanks for your inputs. regards _______________________________________________ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice