Frage

I'm using System::IO::Ports for a project that requires sending data over a serial port and I'm not sure why the "^" operator is being used on my data types.

For instance, take this code snippet:

SerialPort^ serialPort = gcnew SerialPort();

array<String^>^ serialPorts = SerialPort::GetPortNames();

Now what exactly is the purpose of the caret operator here? I know what an exclusive or operation is, but I don't see how it applies in this instance. What are the strings being XOR'd with?

I tried to search for the answer to this, but every answer deals with a description of what XOR logic is, not how it's used in a circumstance like this.

The code works, I'm just asking from a curiosity standpoint. If anyone happens to know the answer, throw me a reply and I'll give you a mad high-five

War es hilfreich?

Lösung

This is NOT XOR. Its Microsofts spin on C++(C++/CLI). The String^ represents system::string which is different than std::string.

Andere Tipps

It's not an XOR. This is C++/CLI code and T^ (for any .NET reference type T) is a "handle" or managed reference.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top