Date: prev next · Thread: first prev next last
2013 Archives by date, by thread · List index


On 12/02/2013 11:00, Noel Power wrote:
Hi Julien
On 12/02/13 09:00, julien2412 wrote:
Cppcheck reported this:
basic/source/comp/sbcomp.cxx
600 unassignedVariable style Variable 'TimeBuffer' is not assigned a value.
...

By taking a look at the file, I notice there was 1 #ifdef DBG_TRACE_BASIC and several blocks of #ifdef DBG_TRACE_PROFILING. Is it really useful to keep both? What about removing DBG_TRACE_PROFILING and considerin that
DBG_TRACE_BASIC should enable all debug (Basic + profiling) ?

I never used this snazy debug support but always wanted to check it out, being able to dump out the pcode ( which at a quick glance seems to be supported ) is *very* useful. I am not convinced the timing information support offered when DBG_TRACE_PROFILING is really useful ( cachegrind etc seem a better choice for that ) But.. then again a cheap and nasty indicator doesn't do any harm, personally I would not lump the 2 together I would guess the timer related output if it were always on would introduce lots of *noise* into the trace info. For me the choice would be either squash the warning or remove (carefully) the DBG_TRACE_PROFILING related functionality ( and the offending variable). Now IMHO removing that stuff is probably more effort than it's worth and squashing the warning would be the easiest thing to do.

would
TimerBuffer[0] = '\0' satisfy cppcheck or is the following statement legal
char TimeBuffer[200="";
( it works for me on gcc but would not bet its really valid c++ )
Thank you Noel for your detailed answer. I pushed a fix on master (see http://cgit.freedesktop.org/libreoffice/core/commit/?id=fc27fec0543009dbb6c6ca002283564215aae4b1).

After having read some forums like stackoverflow, it seems the standard and secure way was "memset". (std::fill seemed to me appropriate for more "C++ish" elements like vectors than for an array of chars)

Julien

Context


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.