Board index » cppbuilder » WideString (BDS2006)

WideString (BDS2006)


2006-05-14 08:52:22 PM
cppbuilder74
Hi,
Can anyone please explain the following to me....
Using the following code:
const WideString S1 = "Hello";
WideString S2 = "Hello";
WideChar C1 = S1[1];
WideChar C2 = S2[1];
C1 comes out as 'e'
C2 comes out as 'H'
If I do:
const WideString S1 = "Hello";
WideString S2 = "Hello";
WideChar C1 = S1[0];
WideChar C2 = S2[0];
C1 comes out as 'H'
C2 comes out as '\0'
Call me stupid but I just don't get it!
 
 

Re:WideString (BDS2006)

Check out this link:
qc.borland.com/wc/qcmain.aspx
- Clayton
 

Re:WideString (BDS2006)

Wow, you reported that back in 2002 and it still hasn't been sorted?!
Thanks for the heads up, I'll apply that workaround - although I'll then
have to change my code again because I've allowed for that strangeness now!
 

{smallsort}

Re:WideString (BDS2006)

At 18:39:07, 14.05.2006, Richard Bradbrook wrote:
Quote
Wow, you reported that back in 2002 and it still hasn't been sorted?!
That is a long time, indeed. That was in the BCB6 timeframe, AFAICS. I
see that Alisdair opened the report in 2005.
--
Rudy Velthuis [TeamB] rvelthuis.de/
"If thereís one thing I know itís God does love a good joke."
-- Hugh Elliott, Standing Room Only weblog, 05-01-04
 

Re:WideString (BDS2006)

I'd also like to caution against the use of my workaround. The modification
would have to be made every time Builder is installed and on every system
that builds your code. Since I made that QC entry I've opted against using
the workaround. It just creates one more potential error point.
It isn't too much more overhead to do this:
WideString(Str)[1]
... or this ...
const_cast <WideString&>(Str)[1]
And put a comment next to the code or a version check somewhere in the unit
like this:
#if __BORLANDC__>0x581
#error Check if this code now executes correctly
// WideString const test(L"Hi");
// ShowMessage((char) test[1]); // should be 'H' not 'i'
#endif
- Clayton
 

Re:WideString (BDS2006)

In article <44677ae8$ XXXX@XXXXX.COM >,
"Clayton Arends" < XXXX@XXXXX.COM >wrote:
Quote
#if __BORLANDC__>0x581
0x582 is the current version.
--
-David
Nihil curo de ista tua stulta superstitione.
 

Re:WideString (BDS2006)

David Dean wrote:
Quote
In article <44677ae8$ XXXX@XXXXX.COM >,
"Clayton Arends" < XXXX@XXXXX.COM >wrote:

>#if __BORLANDC__>0x581

0x582 is the current version.

It is, but you should always take into account people who did not
installed service pack(s). So safe bet would be:
#if __BORLANDC__>= 0x0580
 

Re:WideString (BDS2006)

The #if is being used to signal an error when a newer compiler is released.
The version number should always be the latest one that has been tested. In
this case, as David pointed out, is BDS2006 Update #2 ... 0x582.
The purpose of the check is to cause the developer to check if the commented
code works in a newer release. Once the fix has been put in place then a
different kind of #if can be used. Assuming Borland fixes this problem in
Update 3 for BDS (*cough*):
#if __BORLANDC__ < 0x583
WideString(Str)[index]
#else
Str[index]
#endif
- Clayton
 

Re:WideString (BDS2006)

On Mon, 15 May 2006 08:16:20 -0700, "Clayton Arends"
< XXXX@XXXXX.COM >wrote:
Quote
different kind of #if can be used. Assuming Borland fixes this problem in
Update 3 for BDS (*cough*):
IIRC recently someone from borland (JK?) mentioned in one of delphi
groups that there won't be update 3 for bds 2006 (only some small
hotfixes) which is a shame on borland since even after update 2 it is
nowhere near acceptable level of quality :(
--
Vladimir Ulchenko aka vavan