If I compile with /clr:safe, which is exactly meant by saying I can't
use "Native Types" in my code? Is a native type something such as
float, short, or int?
Thanks,
Gary 8 2082
Gary Nastrasio schrieb: If I compile with /clr:safe, which is exactly meant by saying I can't use "Native Types" in my code? Is a native type something such as float, short, or int?
No. AFAIK, this types will be mapped to System::Single, System::Int16
and System::Int32
--
Greetings
Jochen
My blog about Win32 and .NET http://blog.kalmbachnet.de/
"Gary Nastrasio" <ga***********@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
| If I compile with /clr:safe, which is exactly meant by saying I can't
| use "Native Types" in my code? Is a native type something such as
| float, short, or int?
|
| Thanks,
|
| Gary
No, native types are types like pointers (int* blabla) user defined native
types (class, struct...) C++ intrinsic types like wchar_t etc..
Primitive types like int, short, float, double ... are directly mapped to
the corresponding CLR types System::Int32, Int16, Float, Double ..
Willy.
Willy Denoyette [MVP] wrote: "Gary Nastrasio" <ga***********@hotmail.com> wrote in message news:%2****************@TK2MSFTNGP10.phx.gbl... If I compile with /clr:safe, which is exactly meant by saying I can't use "Native Types" in my code? Is a native type something such as float, short, or int?
Thanks,
Gary
No, native types are types like pointers (int* blabla) user defined native types (class, struct...) C++ intrinsic types like wchar_t etc.. Primitive types like int, short, float, double ... are directly mapped to the corresponding CLR types System::Int32, Int16, Float, Double ..
wchar_t maps to System::Char in managed C++, so it's fine for /clr:safe as
well as the other intrinsic types you mentioned.
-cd
"Carl Daniel [VC++ MVP]" <cp*****************************@mvps.org.nospam >
wrote in message news:ex***************@TK2MSFTNGP12.phx.gbl...
| Willy Denoyette [MVP] wrote:
| > "Gary Nastrasio" <ga***********@hotmail.com> wrote in message
| > news:%2****************@TK2MSFTNGP10.phx.gbl...
| >> If I compile with /clr:safe, which is exactly meant by saying I can't
| >> use "Native Types" in my code? Is a native type something such as
| >> float, short, or int?
| >>
| >> Thanks,
| >>
| >> Gary
| >
| > No, native types are types like pointers (int* blabla) user defined
| > native types (class, struct...) C++ intrinsic types like wchar_t etc..
| > Primitive types like int, short, float, double ... are directly
| > mapped to the corresponding CLR types System::Int32, Int16, Float,
| > Double ..
|
| wchar_t maps to System::Char in managed C++, so it's fine for /clr:safe as
| well as the other intrinsic types you mentioned.
|
Very true, but it's usage is somewhat limitted.
wchar_t wch = 'A'; // is OK
but...
wchar_t* wsp = L"Test";
wchar_t wch[] = L"123";
are not..
Willy.
Willy Denoyette [MVP] wrote: "Carl Daniel [VC++ MVP]" wchar_t maps to System::Char in managed C++, so it's fine for /clr:safe as well as the other intrinsic types you mentioned.
Very true, but it's usage is somewhat limitted.
wchar_t wch = 'A'; // is OK but... wchar_t* wsp = L"Test"; wchar_t wch[] = L"123"; are not..
True that.
-cd
> | If I compile with /clr:safe, which is exactly meant by saying I can't | use "Native Types" in my code? Is a native type something such as | float, short, or int?
No, native types are types like pointers (int* blabla) user defined native types (class, struct...) C++ intrinsic types like wchar_t etc..
If I read this literally it sounds like one can't do any custom object
oriented programming in /clr:safe mode. After all, if a user-defined class
is a native type, and native types aren't allowed in /clr:safe mode, I can
conclude I can't define my own classes in /clr:safe mode (based on the two
statements above, the bottom one being a response for the top one).
Or are you making a distinction here between 'class' and 'ref class'?
[==P==]
"Willy Denoyette [MVP]" <wi*************@telenet.be> wrote in message
news:%2****************@tk2msftngp13.phx.gbl... "Gary Nastrasio" <ga***********@hotmail.com> wrote in message news:%2****************@TK2MSFTNGP10.phx.gbl... | If I compile with /clr:safe, which is exactly meant by saying I can't | use "Native Types" in my code? Is a native type something such as | float, short, or int? | | Thanks, | | Gary
No, native types are types like pointers (int* blabla) user defined native types (class, struct...) C++ intrinsic types like wchar_t etc.. Primitive types like int, short, float, double ... are directly mapped to the corresponding CLR types System::Int32, Int16, Float, Double ..
Willy.
"Peter Oliphant" <po*******@RoundTripInc.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
|> | If I compile with /clr:safe, which is exactly meant by saying I can't
| > | use "Native Types" in my code? Is a native type something such as
| > | float, short, or int?
|
| > No, native types are types like pointers (int* blabla) user defined
native
| > types (class, struct...) C++ intrinsic types like wchar_t etc..
|
| If I read this literally it sounds like one can't do any custom object
| oriented programming in /clr:safe mode. After all, if a user-defined class
| is a native type, and native types aren't allowed in /clr:safe mode, I can
| conclude I can't define my own classes in /clr:safe mode (based on the two
| statements above, the bottom one being a response for the top one).
|
| Or are you making a distinction here between 'class' and 'ref class'?
|
Yep, this only applies to C++ class and struct, that's what I meant with ...
user defined native types ..
Sorry for the confusion.
Willy.
Willy,
No apology needed, I learned something new! I should be thanking you... : )
[and that rhymed...lol]
[==P==]
"Willy Denoyette [MVP]" <wi*************@telenet.be> wrote in message
news:%2****************@tk2msftngp13.phx.gbl... "Peter Oliphant" <po*******@RoundTripInc.com> wrote in message news:%2****************@tk2msftngp13.phx.gbl... |> | If I compile with /clr:safe, which is exactly meant by saying I can't | > | use "Native Types" in my code? Is a native type something such as | > | float, short, or int? | | > No, native types are types like pointers (int* blabla) user defined native | > types (class, struct...) C++ intrinsic types like wchar_t etc.. | | If I read this literally it sounds like one can't do any custom object | oriented programming in /clr:safe mode. After all, if a user-defined class | is a native type, and native types aren't allowed in /clr:safe mode, I can | conclude I can't define my own classes in /clr:safe mode (based on the two | statements above, the bottom one being a response for the top one). | | Or are you making a distinction here between 'class' and 'ref class'? |
Yep, this only applies to C++ class and struct, that's what I meant with ... user defined native types .. Sorry for the confusion.
Willy. This discussion thread is closed Replies have been disabled for this discussion. Similar topics
4 posts
views
Thread by fareeda |
last post: by
|
reply
views
Thread by Jeff D. Hamann |
last post: by
|
6 posts
views
Thread by Clint Olsen |
last post: by
|
reply
views
Thread by William Stacey [MVP] |
last post: by
|
12 posts
views
Thread by Herby |
last post: by
| |
reply
views
Thread by ivan.leben |
last post: by
|
10 posts
views
Thread by SQACPP |
last post: by
|
1 post
views
Thread by ajk |
last post: by
| | | | | | | | | | |