[Mono-osx] Unsafe code on MonoDevelop 2.4.2 OS X

Stifu stifu at free.fr
Sat Jul 2 13:19:17 EDT 2011


Hi,

You don't have to use command lines.
Right click your project > Options > Compilation (General) > Allow unsafe
code


Fuith wrote:
> 
> Hi Guys,
>         I'm trying to run a program with an unsafe section (see below).
> But when I try to build it it tells me "Unsafe code requires the 'unsafe'
> command line option to be specified", Does anybody know a fix for this or
> how to compile C# code in the terminal?
> 
> using System;
> 
> namespace pointerTest
> {
> 	class MainClass
> 	{
> 		static unsafe void Main ()
> 		{
> 			int[, ,] a = new int[2, 3, 4];
> 			{
> 				fixed (int* p = a)
> 				{
> 					for (int i=0; i < a.Length; ++i)
> 						p[i] = i;
> 				}
> 			}
> 			for (int i=0; i<2; ++i)
> 				for (int j=0; j<3; ++j)
> 				{
> 					for (int k=0; k<4; ++k)
> 						Console.Write("[{0},{1},{2}] = {3,2} ", i, j, k, a[i, j, k]);
> 					Console.WriteLine();
> 			}
> 		}
> 	}
> }
> 


--
View this message in context: http://mono.1490590.n4.nabble.com/Unsafe-code-on-MonoDevelop-2-4-2-OS-X-tp3640685p3640813.html
Sent from the Mono - OSX mailing list archive at Nabble.com.


More information about the Mono-osx mailing list