Hi Phil: What is the proper C++ way to initialize the private non-const member m_prevSymbol of the PlDevice class to an invalue value (i.e., 0)? valgrind is complaining about the uninitialized use of m_prevSymbol for a test in PlDevice::DrawTextLine, and I am looking for a way to shut it up. And we want that test to always fail the first time (hence the need for an assignment to an invalid value) before m_prevSymbol is assigned a valid value later in the routine.
I tried replacing PLUNICODE m_prevSymbol; by PLUNICODE m_prevSymbol = 0; in the private area of the PlDevice class defined in drivers/wxwidgets.h, and that indeed made valgrind shut up, i.e., the summary line is ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0) but now I have the following compiler warning message: In file included from /home/software/plplot/HEAD/plplot.git/drivers/wxwidgets.cpp:41:0: /home/software/plplot/HEAD/plplot.git/drivers/wxwidgets.h:103:30: warning: non-static data member initializers only available with -std=c++11 or -std=gnu++11 PLUNICODE m_prevSymbol = 0; I tried using the static attribute for m_prevSymbol, but the compiler errored out in that case because the const attribute was not used. However, const is inappropriate because m_prevSymbol does get updated in the above routine. So the question boils down to a simple one which is what is the proper C++ way to initialize a private non-const data member such as m_prevSymbol without generating compiler warnings or errors? Alan __________________________ Alan W. Irwin Astronomical research affiliation with Department of Physics and Astronomy, University of Victoria (astrowww.phys.uvic.ca). Programming affiliations with the FreeEOS equation-of-state implementation for stellar interiors (freeeos.sf.net); the Time Ephemerides project (timeephem.sf.net); PLplot scientific plotting software package (plplot.sf.net); the libLASi project (unifont.org/lasi); the Loads of Linux Links project (loll.sf.net); and the Linux Brochure Project (lbproject.sf.net). __________________________ Linux-powered Science __________________________ ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot _______________________________________________ Plplot-devel mailing list Plplot-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/plplot-devel