Why is IsConst emitted twice in char * const a

78 views Asked by At

I've disassmebled the following C++/CLI code in ildasm:

Managed(char * const a)
{

}

and the disassembled IL looks like this:

.method public hidebysig specialname rtspecialname 
        instance void  .ctor(int8 modopt([mscorlib]System.Runtime.CompilerServices.IsSignUnspecifiedByte)* modopt([mscorlib]System.Runtime.CompilerServices.IsConst) modopt([mscorlib]System.Runtime.CompilerServices.IsConst) a) cil managed

Removing some insignificant parts:

.method public hidebysig specialname rtspecialname 
        instance void .ctor(int8* modopt(IsConst) modopt(IsConst) a) cil managed

So while there is only one const in the original code, it is emitted twice in the IL. Why is that so?

0

There are 0 answers