VC.NET 2005 and ^

G

Guest

Hi,

I have a RC version of VC.NET 2005 for testing purpose and i would like to
understand the purpose of ^ character.

Now instead to write :

String strTest="";

we need to write :
String^ strTest= "";

why and what are the implications of this changes ?
i did not find any information in help about it except few words and without
any real detail.

Precision : i'm working under Windows.Forms.

thanks a lot,
Maileen
 
A

Arnaud Debaene

Maileen said:
Hi,

I have a RC version of VC.NET 2005 for testing purpose and i would
like to understand the purpose of ^ character.

Now instead to write :

String strTest="";
You mean instead of String* strTest="" (old C++ Managed syntax).
we need to write :
String^ strTest= "";

why and what are the implications of this changes ?
The purpose is to make clearer the difference between pointers (pointing to
native objects) and handles (referencing managed objects). The latter ones
were called "__gc pointers" in managed C++.
i did not find any information in help about it except few words and
without any real detail.
You didn't search strong enough ;-)
http://msdn2.microsoft.com/en-us/library/yk97tc08 (&mong many other articles
on the subject).

Arnaud
MVP - VC
 
T

Tom Serface

I think this is one of the best extensions they did and it looks like C++ in
a way. It is also very clear to see the difference between * and ^
pointers.

Tom
 
P

Peter Oliphant

OK, now I'm worried. If I upgrade to 2005 from 2003 does this mean all my
managed pointers (*) must now be changed to handles (^), that all my managed
new's must be changed to gcnew, etc.? Or is it backwards compatible and
these are new addtional features?

[==P==]

Nishant Sivakumar said:
http://www.voidnish.com/articles/ShowArticle.aspx?code=cppcliintro01

--
Regards,
Nish [VC++ MVP]


Maileen said:
Hi,

I have a RC version of VC.NET 2005 for testing purpose and i would like
to
understand the purpose of ^ character.

Now instead to write :

String strTest="";

we need to write :
String^ strTest= "";

why and what are the implications of this changes ?
i did not find any information in help about it except few words and
without
any real detail.

Precision : i'm working under Windows.Forms.

thanks a lot,
Maileen
 
J

Jochen Kalmbach [MVP]

Hi Peter!
OK, now I'm worried. If I upgrade to 2005 from 2003 does this mean all my
managed pointers (*) must now be changed to handles (^), that all my managed
new's must be changed to gcnew, etc.? Or is it backwards compatible and
these are new addtional features?

You can use the "/clr:blush:ldsyntax" switch to be (mostly) compatible with
VC2003.

--
Greetings
Jochen

My blog about Win32 and .NET
http://blog.kalmbachnet.de/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top