1

I'm looking for an idea how to find all the while loops in my huge code that declare a variable within the loop header. The problem is that

while ( item a = list.next() )

is not working correctly in xlC 12.1 : the constructor of 'item' is called for each iteration of the loop, but the destructor is called only once. This seems to be a bug in the compiler. The result was a memory leak with the new compiler.

Anyway, I want to make sure it doesn't happen in other places in the program, and I don't really know how to do it. Any ideas?

ModdyFire
  • 706
  • 3
  • 9
  • 19
  • A regular expression leaps to mind. I don't suppose you're hip on Perl? – WhozCraig Oct 02 '13 at 04:56
  • If the example is exactly what you show it as, why won't a regexp do? If the example is not exactly as shown, can you please provide some details on how complex it might become? – Ira Baxter Oct 02 '13 at 04:56
  • Basically, "item" can be any class, "a" can be any name, the assignment could be replaced by any constructor ... E.g. I need to find also "while ( xml::Node node(document,current) )" – ModdyFire Oct 02 '13 at 11:25

0 Answers0