473,322 Members | 1,501 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

What is the Caret Qualifier??

weaknessforcats
9,208 Expert Mod 8TB
I am not a Java or C# person and I have been seeing this as purported C++:
Expand|Select|Wrap|Line Numbers
  1. String ^g;
  2.  
What does the ^ mean?

No info in my C# text and no info I could find with Google.
Oct 22 '07 #1
21 12516
RedSon
5,000 Expert 4TB
I am not a Java or C# person and I have been seeing this as purported C++:
Expand|Select|Wrap|Line Numbers
  1. String ^g;
  2.  
What does the ^ mean?

No info in my C# text and no info I could find with Google.
http://msdn2.microsoft.com/en-us/library/zkacc7k1.aspx ??
Oct 22 '07 #2
NeoPa
32,556 Expert Mod 16PB
Unless I'm mistaken, that doesn't explain the usage as a unary operator Aaron (as in this example). Not that I can help I'm afraid :(
Oct 22 '07 #3
JosAH
11,448 Expert 8TB
I am not a Java or C# person and I have been seeing this as purported C++:
Expand|Select|Wrap|Line Numbers
  1. String ^g;
  2.  
What does the ^ mean?

No info in my C# text and no info I could find with Google.
In Pascal and Modula the prefix unary '^' means 'pointer to'; but I don't know
what it is supposed to mean in other languages.

kind regards,

Jos
Oct 22 '07 #4
drhowarddrfine
7,435 Expert 4TB
I wonder if they're getting confused with a regular expression part.
Oct 22 '07 #5
RedSon
5,000 Expert 4TB
Unless I'm mistaken, that doesn't explain the usage as a unary operator Aaron (as in this example). Not that I can help I'm afraid :(
Sure, sure...just make fun of my response but don't offer anything of your own! Bah, a pox upon you!
Oct 22 '07 #6
NeoPa
32,556 Expert Mod 16PB
: D
Oct 22 '07 #7
Atli
5,058 Expert 4TB
I've always thought of this as a pointer to a .Net Object. Used only with .Net objects in C++.

I've never seen it used in normal C++, just with that .Net MFC stuff.
Check out the C++ example in the msdn ArrayList documentation.

I'm not all that good with C++ so this may be all wrong :P
Oct 23 '07 #8
JosAH
11,448 Expert 8TB
I've always thought of this as a pointer to a .Net Object. Used only with .Net objects in C++.

I've never seen it used in normal C++, just with that .Net MFC stuff.
Check out the C++ example in the msdn ArrayList documentation.

I'm not all that good with C++ so this may be all wrong :P
If Microsoft calls this:

Expand|Select|Wrap|Line Numbers
  1. void PrintValues( IEnumerable^ myList );
  2.  
... C++ they've gone completely nutters. 'nuff said.

kind regards,

Jos
Oct 23 '07 #9
Banfa
9,065 Expert Mod 8TB
If Microsoft calls this:

Expand|Select|Wrap|Line Numbers
  1. void PrintValues( IEnumerable^ myList );
  2.  
... C++ they've gone completely nutters. 'nuff said.
It's Managed C++ or C++/CLR which has some sytatic differences from actual C++ but can make .NET calls. It's C++.NET :D
Oct 23 '07 #10
JosAH
11,448 Expert 8TB
It's Managed C++ or C++/CLR which has some sytatic differences from actual C++ but can make .NET calls. It's C++.NET :D
*eeewww!* Stay from me thou speaker in many tongues! <holds up a wooden cross/>

kind regards,

Jos ( <--- they've gone completely bonkers alright ;-)
Oct 23 '07 #11
drhowarddrfine
7,435 Expert 4TB
lol .
Oct 23 '07 #12
r035198x
13,262 8TB
When is someone going to ask why this thread is here and not in some other location?
Oct 24 '07 #13
Banfa
9,065 Expert Mod 8TB
When is someone going to ask why this thread is here and not in some other location?
I bet on 25th October at 3:07:24.55 am
Oct 24 '07 #14
NeoPa
32,556 Expert Mod 16PB
Good point Evans. I'll move it to C / C++ forum.
Oct 24 '07 #15
r035198x
13,262 8TB
I bet on 25th October at 3:07:24.55 am
Don't ever go into betting Ben.
@NeoPa, I'd have checked with weakness first ...
Oct 24 '07 #16
weaknessforcats
9,208 Expert Mod 8TB
What I did wwas take the example referred to by JosAH and changed the ^ to an *:
Expand|Select|Wrap|Line Numbers
  1. // Creates and initializes a new ArrayList.
  2.    ArrayList^ myAL = gcnew ArrayList;
  3. //
  4. //I changed it to:
  5.    ArrayList* myAL = gcnew ArrayList;
  6.  
and got an error that you can't use the * indirection with an ArrayList.

With that as a clue I have learned that the ^ declares a reference handle. (what the regular C++ folks call a smart pointer).

As soon as I had the phrase "reference handle" there were suddenly thousands of web pages about this.

Interestingly, the ^ as used here is not an operator. Nor does MSDN ever refer to the ^ when discussing indirection.

Not until you search for reference handle in C++ do you get this.

Hence, the ^ identifies an object on the managed heap whose instances are tracked by the garbage collector whereas the * identifies an object on the CRT heap (and hence can't be used in managed code) whose instances you have to track yourself.

I hope JosAH has a very large silver cross with, perhaps, a lot of garlic.
Oct 24 '07 #17
Banfa
9,065 Expert Mod 8TB
Not until you search for reference handle in C++ do you get this.

Hence, the ^ identifies an object on the managed heap whose instances are tracked by the garbage collector whereas the * identifies an object on the CRT heap (and hence can't be used in managed code) whose instances you have to track yourself.
Thanks for digging that out :-)

I hope JosAH has a very large silver cross with, perhaps, a lot of garlic.
and may be a high power water pistol full of Holy Water
Oct 25 '07 #18
rhitam30111985
112 100+
i thought ^ qualifier finds the xor of two integers . didntr know about its use as a unary operator... i am loving TSDN day by day. .
Oct 25 '07 #19
Banfa
9,065 Expert Mod 8TB
i thought ^ qualifier finds the xor of two integers . didntr know about its use as a unary operator... i am loving TSDN day by day. .
IN standard C++ it is the xor operator. Be careful the usage highlighted is a Microsoftism for use in managed code applications.
Oct 25 '07 #20
Good post weaknessforcats. I love C++ but the .NET managed stuff sure mucks things up. I have lots of unmanaged code that I am currently integrating with managed code. I still have some hair to pull out!
Oct 26 '07 #21
As you can see at:
http://msdn2.microsoft.com/en-us/lib...orystream.aspx

The are using the caret quite a bit in the .NET FrameWork 3.0.

MemoryStream^ memStream = gcnew MemoryStream( 100 );

However, in .NET Framework 1.1 (for example) you need to use:


MemoryStream* memStream = __gc new MemoryStream( 100 );
Oct 26 '07 #22

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: - ions | last post by:
hi, i am in the procces of writing a chat program for a main Assigment, the problem im stuck on is one of the Carets position in a JTextArea, when i hit the enter key, it appends the msg to the...
1
by: Barry | last post by:
Retoring Caret Position after text field correction -------------------------------------------------------------------------------- Hi, my code has the following form - function...
3
by: Noah | last post by:
I have a text field in a form. I want the user to be able to click a DELETE button and have the character at the cursor position deleted. This would be just as if the user had pressed the Back...
7
by: Paul Gorodyansky | last post by:
Hi, Say I have a text in my TEXTAREA box - 01234567890 I want - using script - insert say "abc" in the middle. Works almost OK in Internet Explorer (with one problem) based on their example...
4
by: cc | last post by:
Hi, Is possible set and get the caret position of cursor in a text field ? Thanks, Carlo
2
by: randy | last post by:
Hi, I'm trying to set up a richtextbox to behave like the text area in a web browser, i.e. no caret, and a cursor that changes depending on what it's hovering over. I've been setting the...
1
by: Claire | last post by:
I'm writing an application with custom skinned controls. I have a text editor form with a rich edit control. Because there's no toolbuttons in the skinned control set, I have to use normal ones for...
0
Jezternz
by: Jezternz | last post by:
Okay, so a while back I managed to retrieve it correctly. In this thread: http://bytes.com/topic/javascript/answers/786211-retrieving-caret-start-end-values#post3127765 However I have found...
0
by: Appazi58 | last post by:
Hi, I am trying to develop online chat window. For this I opted for content editable div for sending and receiving messages. I have written javascript to add the image when the user clicks on image....
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.