With so many new terms flying about, it is appropriate to clear the air before moving on. Table 29.1 defines some terms which will be needed in the discussion that follows . Table 29.1. Definitions of managed versus unmanaged, and safe versus unsafe codes
One important thing to understand is that both safe and unsafe codes are considered to be managed codes. Despite the use of pointer variables and other 'unsafe' stuff, unsafe codes still run within the confines of the .NET CLR (see Figure 29.1). Figure 29.1. Managed codes run within the confines of the CLR, while unmanaged codes do not.
C# has three special keywords for writing unsafe codes only: sizeof , stackalloc , and fixed . Both the fixed and sizeof keywords will be covered in this chapter, but stackalloc is outside the scope of this book. |