tru64-unix-managers (formerly alpha-osf-managers) (1994-2012)
 help / color / mirror / Atom feed
From: Christian Jabs <jabs () voelkel ! de>
To: tru64-unix-managers
Subject: Compiler Bug?
Date: Thu, 06 Jul 2000 08:42:17 +0000	[thread overview]
Message-ID: <96287840606207.tru64-unix-managers.marc@archive.invalid> (raw)

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

                 reply	other threads:[~2000-07-06  8:42 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox