0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

unsigned shortに対応する型 > どれを使えばいいかわからない > UINT16 | USHORT | WORD

Last updated at Posted at 2015-04-20
動作確認
Windows 7pro (32bit)

Visual Studioやc++ builderなどでソフトを作る時、unsigned short型が出てくる。

secureCodingによると、unsigned shortなどの型をそのまま使うのはよくない(内部表現、型が異なる場合があるため)らしい。

そこで、typedefしているものを調べたら、以下のサイトがあった。
https://msdn.microsoft.com/en-us/library/windows/desktop/aa383751%28v=vs.85%29.aspx

ここで、typedef unsigned shortしている型として以下のものがある。このうち、どれを使えばいいのかよくわかっていない。

  • UINT16
  • USHORT
  • WORD

こちらを見るとUINT16は正確にはSystem.UInt16なのか。

以下はLinkの表の抜出し。

.NET Framework型 VB.NET型 C#型
System.UInt16 UShort ushort
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?