CIL: Difference between revisions

38 bytes added ,  4 years ago
m
fix links
[unchecked revision][unchecked revision]
m (Grammar- "its" is possessive, "it's" is a contraction.)
m (fix links)
 
Line 6:
 
==Safe and unsafe code==
CIL byte code can either be considered safe or unsafe. By default, all C# is safe, which means that the execution system knows where all the data is, all the time. Therefore it is not possible to use pointers in safe code. Thanks to this property, the most common security and stability problems are eliminated, such as buffer overflows and dangling pointers. A [[Garbage collection|garbage collector]] is employed to use the memory as efficient as possible.
 
===Unsafe code===
Although pointers are not possible in safe code, CIL supports unsafe code which does have support for pointers. Unsafe code is contained in blocks of code which is marked 'unsafe', and in C# it uses the same syntax as C and C++. Objects can be ''pinned'' so that the [[Garbage collection|garbage collector]] doesn't move the data around and pointers remain valid. Using unsafe code is perfectly legal, although discouraged in normal application programming, and may be used to write kernel-level methods.
 
==Executing CIL Code==
170

edits