Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

Unsafe Code

Unsafe code is an ominous name. What developer wants to purposely write unsafe code? In .NET, unsafe code really means potentially unsafe code, which is code or memory that exists outside the normal boundaries of the CLR. For this reason, developers should approach the use of unsafe code with caution.

In unsafe code, developers can access raw pointers. You can use pointer operators, such as * and &, with these pointers. Pointers should be avoided because they interrupt the normal operation of the GC. However, using unsafe pointers is sometimes necessary. For example, porting algorithms from C++ that rely heavily on pointers is one situation in which unsafe pointers might be beneficial.


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free 10-Day Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint