{"id":2821,"date":"2013-07-12T17:49:34","date_gmt":"2013-07-12T08:49:34","guid":{"rendered":"http:\/\/pchero21.com\/?p=2821"},"modified":"2013-07-12T17:49:34","modified_gmt":"2013-07-12T08:49:34","slug":"size_t-warning-int-is-smaller-than-type-unsigned-long","status":"publish","type":"post","link":"http:\/\/pchero21.com\/?p=2821","title":{"rendered":"size_t warning. int&#8217; is smaller than type &#8216;unsigned long"},"content":{"rendered":"<p>\uc0ac\ub0b4 HP-UX \uc11c\ubc84\uc5d0\uc11c \ucef4\ud30c\uc77c\uc744 \ud558\ub2e4, \uc544\ub798\uc758 Warning \uc774 \ub098\uc654\ub2e4.<\/p>\n<blockquote><p>Warning (suggestion) 887: &#8220;SharedMemory.cpp&#8221;, line 711 # Type &#8216;int&#8217; is smaller than type &#8216;unsigned long&#8217;, unwanted widening in value may result.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; memset(szTotalHexData, 0x00, (iSize * 3) + 1);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ^^^^^^^^^^^^^^ &nbsp;<\/p><\/blockquote>\n<p>\uc774\uc720\uc778\uc989, unsigned long type \uc774 \uc640\uc57c \ud558\ub294\ub370, int type \uc774 \uc654\ub2e4\ub294 \uac83.<\/p>\n<p>\uc774\uc0c1\ud560 \uac83\uc774 \uc5c6\uc5b4\uc11c memset man \ud398\uc774\uc9c0\ub97c \ud655\uc778\ud574 \ubcf4\uc558\ub2e4.<\/p>\n<blockquote><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; void *memset(void *s, int c, size_t n);<\/p><\/blockquote>\n<p>\uacb0\ub860\uc740, \uc800 size_t \uc758 type. \uadf8\ub0e5 int \ud615 \ud0c0\uc785\uc778 \uc904 \uc54c\uc558\ub294\ub370, \uadf8\uac8c \uc544\ub2c8\uc5c8\ub2e4. unsigned long type \uc774\uc5c8\ub2e4.<\/p>\n<p>\ud639\uc2dc\ub098 HP-UX aCC \uc5d0\uc11c\ub9cc \uc801\uc6a9\ub418\ub294\uac74 \uc544\ub2cc\uac00 \uc2f6\uc5b4\uc11c g++ \uc5d0\uc11c\ub3c4 \ucc3e\uc544\ubcf4\uc558\ub2e4.<\/p>\n<p>\ud655\uc778 \uacb0\uacfc, \ub458 \ub2e4 unsigned long type \uc774 \ub9de\uc558\ub2e4.<\/p>\n<p><strong>g++-4.7.3<\/strong><\/p>\n<pre class=\"brush:cpp\">#ifndef __SIZE_TYPE__\n#define __SIZE_TYPE__ long unsigned int\n#endif\n#if !(defined (__GNUG__) &amp;&amp; defined (size_t))\ntypedef __SIZE_TYPE__ size_t;\n\n<\/pre>\n<p><strong>aCC: HP ANSI C++ B3910B A.03.37<\/strong><\/p>\n<p><strong><\/strong><\/p>\n<pre class=\"brush:cpp\">#include &lt;sys\/stdsyms.h&gt;\n\n#ifndef _SIZE_T_INCLUDED\n#       define _SIZE_T_INCLUDED\n\n#       ifndef _SIZE_T\n#               define _SIZE_T\n_NAMESPACE_STD_START\n                        typedef unsigned long size_t;\n_NAMESPACE_STD_END\n#       endif \/** _SIZE_T **\/\n\n#endif \/** _SIZE_T_INCLUDED **\/\n<\/pre>\n<p><strong>&nbsp;<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\uc0ac\ub0b4 HP-UX \uc11c\ubc84\uc5d0\uc11c \ucef4\ud30c\uc77c\uc744 \ud558\ub2e4, \uc544\ub798\uc758 Warning \uc774 \ub098\uc654\ub2e4. Warning (suggestion) 887: &#8220;SharedMemory.cpp&#8221;, line 711 # Type &#8216;int&#8217; is smaller than type &#8216;unsigned long&#8217;, unwanted widening in value may result.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; memset(szTotalHexData, 0x00, (iSize * 3) + 1);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ^^^^^^^^^^^^^^ &nbsp; \uc774\uc720\uc778\uc989, &hellip; <a href=\"http:\/\/pchero21.com\/?p=2821\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[16],"tags":[86,205,206],"_links":{"self":[{"href":"http:\/\/pchero21.com\/index.php?rest_route=\/wp\/v2\/posts\/2821"}],"collection":[{"href":"http:\/\/pchero21.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/pchero21.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/pchero21.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/pchero21.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2821"}],"version-history":[{"count":0,"href":"http:\/\/pchero21.com\/index.php?rest_route=\/wp\/v2\/posts\/2821\/revisions"}],"wp:attachment":[{"href":"http:\/\/pchero21.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2821"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/pchero21.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2821"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/pchero21.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2821"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}