<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>potisan</author_name>
  <author_url>https://blog.hatena.ne.jp/potisan/</author_url>
  <blog_title>potisanのプログラミングメモ</blog_title>
  <blog_url>https://potisan-programming-memo.hatenablog.jp/</blog_url>
  <categories>
    <anon>C++</anon>
  </categories>
  <description>STLはsize_t、Win32 APIはDWORD（あるいはUINT）を使う場合が多いです。size_tからDWORDへは暗黙にキャストできますが、範囲外が切り捨てられる可能性があるのでコンパイル警告が発生します。Cスタイルキャスト(DWORD)...やキャスト演算子static_cast&lt;DWORD&gt;(...)により警告を消せますが、切り捨ての可能性については念頭に置くべきです。 次のコードでは64ビット環境のsize_tと同サイズのstd::uint64_tをDWORDと同サイズのstd::uint32_tへstatic_castしています。キャスト前後の値が異なること（0x123456…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fpotisan-programming-memo.hatenablog.jp%2Fentry%2F2021%2F01%2F31%2F184332&quot; title=&quot;C++ size_t→DWORDキャスト時の注意（UINT、std::uint32_t、unsigned int等） - potisanのプログラミングメモ&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url></image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2021-01-31 18:43:32</published>
  <title>C++ size_t→DWORDキャスト時の注意（UINT、std::uint32_t、unsigned int等）</title>
  <type>rich</type>
  <url>https://potisan-programming-memo.hatenablog.jp/entry/2021/01/31/184332</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
