Export (0) Print
Expand All

5.1 Primitive Types

Visual Studio .NET 2003

Every C++ primitive type corresponds directly to a __value class defined in the common language runtime base class library.

C++ primitive type Runtime Base Class Library value type
char
SByte
signed char
SByte
short
Int16
int
Int32
long
Int32
__int64
Int64
unsigned char
Byte
unsigned short
UInt16
unsigned int
UInt32
unsigned long
UInt32
unsigned __int64
UInt64
float
Single
double
Double
void
Void

Note that char corresponds to Byte under the /J compiler option.

Generally, the C++ types and their __value class equivalents are interchangeable in Managed Extensions. The exception is that a pointer-to the common language runtime type is treated differently than a pointer-to the C++ primitive type as described in Section 5.1. Choosing between the C++ and runtime primitives is largely a matter of convenience.

Note that long and int are represented using the same underlying value type, Int32. To allow overloading methods on long and int the Managed Extensions use the custom modifier Microsoft.VisualC.IsLongModifier to distinguish the type long. For more information, see Reference A. The same is true for long double and double. The unqualified char type is modified by Microsoft.VisualC.NoSignSpecifiedModifier to distinguish it from either signed char or unsigned char. As specified by the Common Language Specification, other CLS languages may not be able to distinguish function overloads that differ only by these custom modifiers.

The Managed Extensions have no null literal, and 0 should be used instead.

Show:
© 2014 Microsoft