Implementing C# for the JVM

There are very significant differences between the CLR and the JVM. A few examples: Java doesn’t have user-defined value types Java generics is completely different to .NET generics Many aspects of C# depend on elements of the framework – delegates etc. You’d need to port the library as well, even for language aspects. Java doesn’t … Read more

Why does struct alignment depend on whether a field type is primitive or user-defined?

I think this is a bug. You are seeing the side-effect of automatic layout, it likes to align non-trivial fields to an address that’s a multiple of 8 bytes in 64-bit mode. It occurs even when you explicitly apply the [StructLayout(LayoutKind.Sequential)] attribute. That is not supposed to happen. You can see it by making the … Read more