Why does the MinValue for an Int32 struct in C# ha

2020-04-03 01:59发布

When I right-click int in my code and select "Go To Definition," Visual Studio opens a file titled "Int32 [from metadata]". This file includes the following line:

public const Int32 MinValue = --2147483648;

What is the meaning of the double -- sign?

enter image description here


I am running Visual Studio 15.8.4. Based on information in the comments, this is not reproducible on all versions of Visual Studio 2017.

1条回答
爷、活的狠高调
2楼-- · 2020-04-03 02:38

vcsjones pointed to the newly created bug report and this post appeared there:

CyrusNajmabadi commented

This is probably a bug i introduced when i fixed up how literals were converted to syntax nodes. There was probably some special casing here that added a - sign. And once the underlying helper was fixed we got double negation.

查看更多
登录 后发表回答