[Info-vax] VMS Cobol - GnuCOBOL
Mark DeArman
s.d.m at ieee.org
Mon Feb 27 16:19:05 EST 2023
On Sat, 25 Feb 2023 19:28:06 -0500, Arne Vajhøj <arne at vajhoej.dk>
wrote:
>On 2/25/2023 4:32 PM, John Dallman wrote:
>> In article <ttd4ta$2j12a$2 at dont-email.me>, arne at vajhoej.dk (Arne Vajhøj)
>> wrote:
>>> C# and Java are very similar. I don't think MS ever made a secret
>>> of that.
>>
>> Microsoft started on .NET during their lawsuit with Sun over their
>> incomplete-but-extended Java implementation. They seem to have hoped to
>> replace Java with .NET.
>
>Yes.
>
>>> There are of course also some differences. C# got
>>> unsafe blocks with pointers (nobody use them) ...
>>
>> The main thing those are useful for is calling native code. It's way
>> easier than using JNI.
>
>I was not thinking about pointer type aka IntPtr, which are commonly
>used for p/Invoke (DllImport).
>
<snip>
>
>I was thinking about real star pointer.
>
>Example:
>
>using System;
>
>namespace StarPtr
>{
> public class Program
> {
> public static void Main(string[] args)
> {
> int[] a = new int[4] { 1, 2, 3, 4 };
> foreach(int ai in a)
> {
> Console.Write(" {0}", ai);
> }
> Console.WriteLine();
> unsafe
> {
> fixed(int *p = &a[0])
> {
> for(int i = 0; i < 4; i++)
> {
> int *p2 = p + i;
> Console.Write(" {0}", *p2);
> }
> Console.WriteLine();
> }
> }
> }
> }
>}
>
>The star pointer do not need to be used with p/Invoke (DllImport) but
>they can be used - I just think it is very rare.
>
<snip>
Exactly. I use C# for building the UI for all my test and measurement
devices, because it's so quick development time wise, and has a pretty
good thirdparty UI widget ecosystem. Having the full suite of unsafe
C tools available makes it a dream, when you have to interface with
tons of random vendor specific drivers and libraries, and the glue
code is very clean and maintainable.
Mark
More information about the Info-vax
mailing list