From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <96287840606207.tru64-unix-managers.marc@archive.invalid> From: Christian Jabs Date: Thu, 06 Jul 2000 08:42:17 +0000 To: tru64-unix-managers Subject: Compiler Bug? X-MARC-Message: https://marc.info/?l=tru64-unix-managers&m=96287840606207 I think I found a compiler bug that occurs in BCB3 and BCB5 (so I think it also in BCB4, but I can't prove it). Try the following two snippets (it should remove spaces from a String): /----- snip1 ----------------------------/ AnsiString s="Test Test"; while( int Pos = s.AnsiPos(" ") ) { s = s.SubString(1, Pos - 1) + s.SubString(Pos + 1, s.Length() - Pos); } /----- end snip1 ------------------------/ /----- snip2 ----------------------------/ AnsiString s="Test Test"; while( int Pos = s.AnsiPos(" ") ) s = s.SubString(1, Pos - 1) + s.SubString(Pos + 1, s.Length() - Pos); /----- end snip1 ------------------------/ I would think the assembler code generated by these two snippets are equal (or at least equivalent). But in snip2 the code does not behave like one could think. You can simply see it if you set s to an empty string (s=""). Though the result in the while inquiry is zero (or false) it enters the following line. Is there s.th. wrong in my train of thoughts? Christian