unsafe static void SquarePtrParam (int* p)
{
*p *= *p;
}
VS
static void SquarePtrParam (ref int p)
{
p *= p;
}
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Safe code can run in any situation where you can run C# code (Silverlight, shared hosting ASP.NET, XNA, SQL Server, etc.), while unsafe code require elevated trust. This means you can run your code in more places and with fewer restrictions.
Also, it’s safe, meaning you don’t have to worry about doing something wrong and crashing your process.