🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #3156

Variant/TVariant bug(?)

#3156
From: Mark Guerrieri
Date: Thu, 24 Aug 2006 00:11
29 lines
1602 bytes
BDS 2006 All SP/HotFixes applied:

Can someone explain this to me please?


AnsiString s1 = "Test";
int len1 = s1.Length();  // len1 = 4
TVariant v1 = s1;
Variant v2 = v1;
AnsiString s2 = (AnsiString)v2;
int len2 = s2.Length(); // len2 = 5 ?!?!?!?


Am I missing something, or did BDS just try to pull a fast one on me?

Replaceing

AnsiString s2 = (AnsiString)v2;

with

WideString s2 = (WideString)v2;

produces the correct results (i.e. length is 4...)

There appears to be a problem converting a Variant of type VOleStr to an 
AnsiString.  Can anyone confirm this for me?

Mark
Technical Details
Message-ID: <44eceece$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!newsfeed.freenet.de!news.code-werk.net!open-news-network.org!news.soft-gems.net!reader.uucp.at!feeder02.uucp.at!newsfeed.uucp.at!news.uucp.at!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,75c3c5ec0c7551b9,start
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Mark Guerrieri" <mguerrieri@no_spam_verizon.net>
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Variant/TVariant bug(?)
Date: Wed, 23 Aug 2006 20:11:59 -0400
Lines: 32
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2869
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2962
NNTP-Posting-Host: 71.245.210.202
Message-ID: <44eceece$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1156378318 71.245.210.202 (23 Aug 2006 17:11:58 -0700)
Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!newsfeed.freenet.de!news.code-werk.net!open-news-network.org!news.soft-gems.net!reader.uucp.at!feeder02.uucp.at!newsfeed.uucp.at!news.uucp.at!newsgroups.borland.com!not-for-mail