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
Context
- [Libreoffice] fighting with debug macros... · Pierre-AndrĂ© Jacquod
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.