C# allows unsafe
methods. From what I read from the help file, PascalABC.NET’s support for pointers is not any better than C#. But there is no mentions of unsafe
methods. The section for pointers
is very limited. It said nothing about allocating and freeing the memory.
unsafe
is just a C# keyword that allows you to use pointers and other stuff like that.
You can write System.Runtime.InteropServices.Marshal
on a new line. Once you place a dot after it - IDE will show you everything you can use for marshaling, including all the ways to allocate and free the memory.
But that’s .Net, not C# or Pascal.
As for Pascal-only things - you have these 2 subprograms for typed pointers:
var p: ^integer;
new(p);
dispose(p);
But they mainly exist for compatibility with older Pascal dialects. If you do things right - you’ll not need them.
1 лайк
unsafe
methods are very useful in C#.