I have found that CIL compiller allows type native float. However, CLR doesn’t allow it. Has it any uses? What is its size? Is there a corresponding .NET type? I tried to implement it as a pseudo-primitive type:
.class public sequential ansi serializable sealed beforefieldinit NativeFloat
extends System.ValueType
{
.field assembly native float m_value
}
However, this type isn’t supported by CLR. Thank you for your help.
Edit: If you’re insterested, its CorElementType is 26 (0x1a, R).
From the CIL ECMA spec, I.12.1.1 Native size: native int, native unsigned int, O and &:
Now, having said that,
native float(as opposed tonative int) is not mentioned a single time in the ECMA spec. The only evidence I can find of it is in some open source CIL assemblers, where they throw an exception stating that they cannot generate an opcode fornative float.If Microsoft’s CIL compiler does in fact accept this type, I would imagine that this was a feature Microsoft intended to implement but did not eventually end up putting into MSIL (CIL’s predecessor). Additionally, if the assembler does in fact produce an opcode instead of an error message, I could conceivably imagine (though again, this is speculation) that there may be variant’s of Microsoft’s CLR (perhaps .NET Micro Framework or a particular version of Silverlight, or something) that supports the opcode.
Also note that in the spec above, the CLI is mentioned. The CLR is merely Microsoft’s implementation of the CLI.
The ECMA spec does mention a native floating point type, but it isn’t
native float: