473,396 Members | 2,002 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,396 software developers and data experts.

Using /clr:safe and Native Types

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
Jan 19 '06 #1
8 2158
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/
Jan 19 '06 #2

"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.
Jan 19 '06 #3
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
Jan 20 '06 #4

"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.

Jan 20 '06 #5
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
Jan 20 '06 #6
> | 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.

Jan 20 '06 #7

"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.


Jan 20 '06 #8
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.

Jan 20 '06 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: fareeda | last post by:
hi, I always get an exception "java.lang.UnsatisfiedLinkError" when I use "cout" in my native function. It works - when i use "printf" - other C++ features Here is an example of the native...
0
by: Jeff D. Hamann | last post by:
Sorry for the seemingly novice posting, but I could find a solution for this on the web so far... I've been developing a database using postgresql (and loving it) and have started running into...
6
by: Clint Olsen | last post by:
I had this crazy idea to use stdarg macros to copy data in a generic fashion, regardless of type. However, I'm not sure it will work in part due to the ANSI C default argument promotions and the...
0
by: William Stacey [MVP] | last post by:
Couple questions. Say we are talking about native types such as int, decimal, long, etc. 1) Does XmlSerializer use Invariant culture to serialize and deserialize number types? 2) If wanted to do...
12
by: Herby | last post by:
Hi, I am currently reviewing what is required to convert a current MFC, COM server application into a .NET application. The objective is to compile ultimately to clr/safe. So we are seeking a...
3
by: dfranzen | last post by:
Hi *, I'm in the process of porting an ANSI C++ project from a UNIX platform to .NET. After "getting rid of" some platform-specific stuff I managed to compile the first two libraries into mixed...
0
by: ivan.leben | last post by:
I am writing this in a new thread to alert that I found a solution to the problem mentioned here: http://groups.google.com/group/comp.lang.c++/browse_thread/thread/7970afaa089fd5b8 and to avoid...
10
by: SQACPP | last post by:
Hi, I try to figure out how to use Callback procedure in a C++ form project The following code *work* perfectly on a console project #include "Windows.h" BOOL CALLBACK...
1
by: ajk | last post by:
Hi I am doing a C++/CLI dll that is supposed to be fully managed code. I was wondering what exactly is the criteria for the DLL to be 100% fully managed and usuable from C#? Do I need to compile...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.