On Aug 7, 1:10 pm, Ron Natalie <r...@spamcop.netwrote:
mos wrote:
Hi! the following code will run without any error on the VC7.1 stdio
debug mode. who can tell me what's the problem?
struct st
{
int a;
};
int _tmain(int argc, _TCHAR* argv[])
{
st* p = new st;
delete p;
p->a = 0;
return 0;
}
One of the insidious forms of undefined behavior is it working
error free (at least for a short time).
The most frequent result of using undefined behavior seems to be
that the code works perfectly in all of the tests, but then
fails in a very visible fashion during the demo in front of the
important client.
--
James Kanze (GABI Software) email:ja*********@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34