Board index » cppbuilder » Re: Yet another show stopping bug!!!
Wiljo
![]() CBuilder Developer |
Re: Yet another show stopping bug!!!2005-10-05 03:54:35 PM cppbuilder12 Zach Saw wrote: QuoteWell, it's not a show stopper for the compiler, that's for sure. I was just Quotedeclare Index first: prevents that memory leak. I consider it best practice to declare any variables just after the closest opening brace '{' of a compound statement, but never inside an iterative loop. I have also found that using AnsiString as arguments for functions causes some memory leaks, and therefore we have written our own string class that doesn't have a memory leak. But to return to the workaround at hand. Although this works at run time, there still is a compile time warning. A good workaround for this is in the comma operator: while( Index = ..., Index != 0 ) or applying parenthesis, whichever one finds handy (or legible): while(( Index = ... ) != 0 ) What about this? The compiler will stop complaining, and code works as expected without any problem. Best Regards, Wiljo. |