dotgnu-general
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[DotGNU]cscc/ecma c# question - 3 (unsafe code)


From: Ravi Mishra
Subject: [DotGNU]cscc/ecma c# question - 3 (unsafe code)
Date: 22 Oct 2002 03:49:35 -0700

Hi,

I am using latest cvs code ...

I am trying to execute unsafe code snippet ...

using System;

class Test
{
        static void WriteLocations(byte[] arr)
        {
                unsafe
                {
                        Console.WriteLine("in unsafe");
                        fixed (byte* pArray = arr)
                        {
                                Console.WriteLine("in fixed");
                                byte* pElem = pArray;
                                for(int i=0; i<arr.Length; i++)
                                {
                                        Console.WriteLine("arr[{0}] at
0x{1:x} is {2}", i, (uint)pElem, value);
                                        pElem++;
                                }
                        }
                }
        }

        static void Main()
        {
                byte[] arr = new byte[] {1, 2, 3, 4, 5};
                WriteLocations(arr);
        }
}

It outputs:
in unsafe

Looks like 'fixed' code segment is not getting executed. 

Any ideas/suggestions?

Thanks,
Ravi
----










reply via email to

[Prev in Thread] Current Thread [Next in Thread]