On Wed, Apr 20, 2011 at 4:44 PM, Koen Deforche <[email protected]> wrote: > Hey Antonio, > > 2011/4/18 Antonio Mancina <[email protected]>: >> Hi all, >> >> if I get it correctly, there's a bug in WDialog.C CTOR, not >> initializing the result_ member variable, neither in the initialization >> list, nor in the CTOR body. > > We could initialize it, but you are not supposed to read the result() > until the dialog has been closed. The fact that the result() is stored > in the dialog is in fact merely a convenience, and usually you should > not need it:
Free to not initialized all members, even if I think is good behavior initialize all members, considering that in some condition (-g0 I think) the compiler can silently fill of 0 not initialized memory occupied by members and under some other condition (-g3) it doesn't. In that way you will not notice the problem (if any) untill you do a "release" build. Having say that I think that the result() methods has to raise an exception then instead of returning a member we are not supposed to read. > By not initializing it, you will at least get a valgrind error if you > are trying to read it in another situation. That's a merely consolation :D My two cents. Gaetano -- cpp-today.blogspot.com ------------------------------------------------------------------------------ Benefiting from Server Virtualization: Beyond Initial Workload Consolidation -- Increasing the use of server virtualization is a top priority.Virtualization can reduce costs, simplify management, and improve application availability and disaster protection. Learn more about boosting the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev _______________________________________________ witty-interest mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/witty-interest
