[PLUG] C++ pointer freeing problem

Tony Rick tonyr42 at gmail.com
Mon Feb 15 00:21:30 UTC 2010


On Sun, Feb 14, 2010 at 4:17 PM, Tony Rick <tonyr42 at gmail.com> wrote:

>
> The corruption may be that member function getRawInput() itself has been
> nuked, or that member variable rawInput has been nuked, or that the  table
> holding the info about class members has been nuked,  Since I can't see how
> a simple reference to the variable or the function call could produce a NaN
> to trigger the exception, I lean toward the last one, which involves an
> index into a lookup table, if I recall my C++ Class implementation details
> correctly.   This would mean that the corruption is way bad, caused by
> writing memory locations gone wild, for example.
>
> One point about accessors (eg, get/setRawInput):  they are generally for
> access from the 'outside world', part of the information hiding paradigm.
> Inside a class instance, member variables are directly accessible, unless
> you go to some extraordiary lengths to make them not so.  I would not use
> get/setRawInput in any of the Validator methods, but the variables
> themselves.
>
>
> const char* charSequence = rawInput.c_str();
>
> - tony
>

For some reason that last line was interpreted as a quote.  I'll try again:

const char* charSequence = rawInput.c_str();

- tony



More information about the PLUG mailing list