J
Jona Schuman
Hi, there was a memory leak in a programming assignment that I'm working
on. The problem seems to have been a syntax error in a delete statment:
delete V1, V2; //where V1 & V2 are pointers to vectors
Running a trace revealed that only V1 was being deleted, and replacing
the line as follows fixed the leak:
delete V1;
delete V2;
My question is, if the difference is purely syntactic, why doesn't the
compiler give an error or warning? (Tested w/ GCC-3.3.4 & VC++ 6.0) Can
delete ever have two operands? And since the original code doesn't do
what it's supposed to, what does it do? (How is the second operand
interpreted by the compiler? It looks like it's just ignored.)
Any insight would be greatly appreciated.
Thanks,
Jona
on. The problem seems to have been a syntax error in a delete statment:
delete V1, V2; //where V1 & V2 are pointers to vectors
Running a trace revealed that only V1 was being deleted, and replacing
the line as follows fixed the leak:
delete V1;
delete V2;
My question is, if the difference is purely syntactic, why doesn't the
compiler give an error or warning? (Tested w/ GCC-3.3.4 & VC++ 6.0) Can
delete ever have two operands? And since the original code doesn't do
what it's supposed to, what does it do? (How is the second operand
interpreted by the compiler? It looks like it's just ignored.)
Any insight would be greatly appreciated.
Thanks,
Jona