473,386 Members | 1,779 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,386 software developers and data experts.

The various levels of /CLI

My program works great in 'vanilla' /CLI, so I tried both '/CLI pure' and
/CLI 'safe'. My program continues to compile and run fine in 'CLI pure' (I
also use error level 4 and don't even get warning errors), but generates
almost 400 compile time errors in '/CLI safe'.

So, more out of curiosity, what are the advantages and disadvantages to each
'level' of /CLI? Since mine will compile and run in '/CLI pure' what am I
'getting' I wouldn't get if it only worked under 'vanilla' /CLI? Since my
program doesn't compile as in '/CLI safe', what am I not 'getting' because
of this?

Thanks in advance for responses!

[==Peter==]
Oct 22 '07 #1
2 1066


"Peter Oliphant" wrote:
Since my
program doesn't compile as in '/CLI safe', what am I not 'getting' because
of this?
CLI / Safe means that the resulting program is pure managed (only containing
IL instructions, and no native CPU instructions), which is the same as CLI /
Pure. The "extra" thing Safe adds is that the program is _verifiable_ by the
runtime.

Verifiable code has certain advantages because it can be proven that claims
about types and methods are always true. In unsafe code, you can't verify
that a program won't access a type or memory location in a way that it wasn't
designed to do, and therefore may have unpredictable effects. Native code is
inherently unverifiable (since the runtime can only prove IL code compiled by
the JIT [or NGen'd]), and pointers are also unverifiable (since you can do
arbitrary arithmetic on them). Other languages which target the runtime (C#
and VB) produce verifiable code by default or even exclusively. C++/CLI is
much harder to do this with, and in my opinion isn't well suited for this
task - native / managed interop is by far its greatest strength.

The big "loss" is that you have to run your app in "fully trusted" mode,
which means that the code gets all the privileges the current logon session
has been granted. If it were verifiable, it could also be made to run in a
"partially trusted" mode, which gives the code less privileges than the logon
session, making the system more secure, and therefore potentially useful in a
wider variety of scenarios, such as from a partially trusted website.
Oct 22 '07 #2
Cool! Thanx, codekaizen! :)

[==Peter==]

"codekaizen" <co********@discussions.microsoft.comwrote in message
news:35**********************************@microsof t.com...
>

"Peter Oliphant" wrote:
>Since my
program doesn't compile as in '/CLI safe', what am I not 'getting'
because
of this?

CLI / Safe means that the resulting program is pure managed (only
containing
IL instructions, and no native CPU instructions), which is the same as CLI
/
Pure. The "extra" thing Safe adds is that the program is _verifiable_ by
the
runtime.

Verifiable code has certain advantages because it can be proven that
claims
about types and methods are always true. In unsafe code, you can't verify
that a program won't access a type or memory location in a way that it
wasn't
designed to do, and therefore may have unpredictable effects. Native code
is
inherently unverifiable (since the runtime can only prove IL code compiled
by
the JIT [or NGen'd]), and pointers are also unverifiable (since you can do
arbitrary arithmetic on them). Other languages which target the runtime
(C#
and VB) produce verifiable code by default or even exclusively. C++/CLI is
much harder to do this with, and in my opinion isn't well suited for this
task - native / managed interop is by far its greatest strength.

The big "loss" is that you have to run your app in "fully trusted" mode,
which means that the code gets all the privileges the current logon
session
has been granted. If it were verifiable, it could also be made to run in a
"partially trusted" mode, which gives the code less privileges than the
logon
session, making the system more secure, and therefore potentially useful
in a
wider variety of scenarios, such as from a partially trusted website.

Oct 22 '07 #3

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

Similar topics

5
by: Travis Pupkin | last post by:
Hey, I've done a number of product catalogs/galleries with one or two category levels (Category > Subcategory). The straightforward way to do this, of course, is to use database fields for...
2
by: \A_Michigan_User\ | last post by:
Ok, I give up. I need to #include the same 1 file (IncludeThis.asp) into 3 different asp files. 1> C:\MyDir\ThisFile.asp 2> D:\MyDir\AASubSub\ThatFile.asp 3>...
5
by: Shane | last post by:
I wonder if someone has any ideas about the following. I am currently producing some reports for a manufacturing company who work with metal. A finished part can contain multiple sub-parts to...
7
by: Felix Kater | last post by:
Hi, when I need to execute a general clean-up procedure (inside of a function) just before the function returns -- how do I do that when there are several returns spread over the whole function?...
5
by: Graham | last post by:
I have created a custom MembershipProvider called "LassieMembershipProvider" that derives from "MembershipProvider". This providor is located in a Businesslogic layer dll called...
13
by: Karch | last post by:
I find myself doing things like this all the time: if ( SomeObject != null && SomeObject.AnotherObject != null && SomeObject.AnotherObject.YetAnother != null &&...
158
by: madhawi | last post by:
This question is occur in interview. Please help me.
2
by: Luca Cioria | last post by:
I have to insert a string in an array at a particular level, creating it if it doesn't exists. example: $levels=array(a,b,c) ***number of variables does vary $name="my_name" what I'd...
8
bilibytes
by: bilibytes | last post by:
Hi everyone, I'm facing a database design problem. I want to make a sort of networking solution for the clients of my site in which they would be able to share or keep private some of their...
3
by: imaloner | last post by:
I am posting two threads because I have two different problems, but both have the same background information. Common Background Information: I am trying to rebuild code for a working,...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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?
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
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...

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.