Should DWORD map to int or uint?

后端 未结 7 1988
抹茶落季
抹茶落季 2021-02-06 22:58

When translating the Windows API (including data types) into P/Invoke, should I replace DWORD with int or uint?

It\'s normally unsigned, but I

相关标签:
7条回答
  • 2021-02-06 23:43

    Well according to the MSDN DWORD is an unsigned integer with a range of 0 to 4294967295.

    So ideally you should replace it with uint rather than int.

    However, as you have spotted uint is non-CLS compliant so if your method is publicly visible you should use int and do the conversion. The corollary to that is that if your method isn't used outside your assembly you should mark it as internal rather than public. Then you'll be able use a uint.

    0 讨论(0)
提交回复
热议问题