Funny how I find what I'm looking for...when I'm not looking for it.
I wish I had this about a month ago :-)

Here's a great site for newbies (like me) learning about Unicode and
especially converting between it and ASCII. There are related links
at the top of the page that you should check out too. Looks like good
info...

http://www.devguy.com/fp/Tips/COM/bstr.htm

Snipped example: the following tip is something I didn't know...

Use ! (==) instead of != with CComBSTR
The following are not the same:

CComBSTR b1, b2;

if (b1 != b2) // this is wrong
{
}

if (!(b1 == b2)) // this is right
{
}

b1 != b2 compares the underlying BSTR pointers
and does not perform a string comparison.

Re: Unicode and COM - newbies should check this out by The

The
Sat May 29 01:01:04 CDT 2004

> Funny how I find what I'm looking for...when I'm not looking for it.
> I wish I had this about a month ago :-)
>
> Here's a great site for newbies (like me) learning about Unicode and
> especially converting between it and ASCII. There are related links
> at the top of the page that you should check out too. Looks like good
> info...
>
> http://www.devguy.com/fp/Tips/COM/bstr.htm
>
> Snipped example: the following tip is something I didn't know...
>
> Use ! (==) instead of != with CComBSTR
> The following are not the same:
>
> CComBSTR b1, b2;
>
> if (b1 != b2) // this is wrong
> {
> }
>
> if (!(b1 == b2)) // this is right
> {
> }
>
> b1 != b2 compares the underlying BSTR pointers
> and does not perform a string comparison.

That is just like java. Absolutely ridiculous.



Re: Unicode and COM - newbies should check this out by Matt

Matt
Sat May 29 03:22:01 CDT 2004

Mike Welch is of the opinion:
> http://www.devguy.com/fp/Tips/COM/bstr.htm
>
> Snipped example: the following tip is something I didn't know...
>
> Use ! (==) instead of != with CComBSTR
> The following are not the same:
>
> CComBSTR b1, b2;
>
> if (b1 != b2) // this is wrong
> {
> }
>
> if (!(b1 == b2)) // this is right
> {
> }
>
> b1 != b2 compares the underlying BSTR pointers
> and does not perform a string comparison.

Well, that's just plain fucked up. Somewhere, there is an API "designer"
who needs to put the crack pipe down, open a window, and let at least some
of the fumes dissipate.

- Matt

Re: Unicode and COM - newbies should check this out by Sarat

Sarat
Sat May 29 12:04:33 CDT 2004

"Mike Welch" <michaelw@techemail.com> wrote in message
news:b3ce3d49.0405282040.578facc9@posting.google.com...
> Funny how I find what I'm looking for...when I'm not looking for it.
> I wish I had this about a month ago :-)
>
> Here's a great site for newbies (like me) learning about Unicode and
> especially converting between it and ASCII. There are related links
> at the top of the page that you should check out too. Looks like good
> info...
>
> http://www.devguy.com/fp/Tips/COM/bstr.htm
>
> Snipped example: the following tip is something I didn't know...
>
> Use ! (==) instead of != with CComBSTR
> The following are not the same:
>
> CComBSTR b1, b2;
>
> if (b1 != b2) // this is wrong
> {
> }
>
> if (!(b1 == b2)) // this is right
> {
> }
>
> b1 != b2 compares the underlying BSTR pointers
> and does not perform a string comparison.

That's an incorrect statement. b1 != b2 works as expected, at least in ATL
7+.

Best,
Sarat Venugopal