<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic int overflow in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/int-overflow/m-p/2856833#M721492</link>
    <description>Hi all,&lt;BR /&gt;&lt;BR /&gt;I was wondering what would happen If I did the following declaration and initialization:&lt;BR /&gt;&lt;BR /&gt;signed char a = 256;&lt;BR /&gt;&lt;BR /&gt;Since a char is only 8 bits its maximun is 255.&lt;BR /&gt;&lt;BR /&gt;I've tested this printf("%x\n", a); and got zero as a result...??&lt;BR /&gt;&lt;BR /&gt;What does really happen when we overflow the system defined limits of basic integer types?&lt;BR /&gt;&lt;BR /&gt;I assume the same would happen when I do for example:&lt;BR /&gt;&lt;BR /&gt;short s_int = 65536;&lt;BR /&gt;&lt;BR /&gt;The answer of printf("%hd\n", s_int); is 0&lt;BR /&gt;&lt;BR /&gt;If I did&lt;BR /&gt;short s_int = 65537;&lt;BR /&gt;&lt;BR /&gt;then the answer will be 1.&lt;BR /&gt;&lt;BR /&gt;Is there a way to predict this behaviour...?&lt;BR /&gt;&lt;BR /&gt;What really happens when we overflow these int types...?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Thanks a lot to everybody in advance....&lt;BR /&gt;&lt;BR /&gt;Max</description>
    <pubDate>Tue, 03 Dec 2002 20:50:05 GMT</pubDate>
    <dc:creator>Max_4</dc:creator>
    <dc:date>2002-12-03T20:50:05Z</dc:date>
    <item>
      <title>int overflow</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/int-overflow/m-p/2856833#M721492</link>
      <description>Hi all,&lt;BR /&gt;&lt;BR /&gt;I was wondering what would happen If I did the following declaration and initialization:&lt;BR /&gt;&lt;BR /&gt;signed char a = 256;&lt;BR /&gt;&lt;BR /&gt;Since a char is only 8 bits its maximun is 255.&lt;BR /&gt;&lt;BR /&gt;I've tested this printf("%x\n", a); and got zero as a result...??&lt;BR /&gt;&lt;BR /&gt;What does really happen when we overflow the system defined limits of basic integer types?&lt;BR /&gt;&lt;BR /&gt;I assume the same would happen when I do for example:&lt;BR /&gt;&lt;BR /&gt;short s_int = 65536;&lt;BR /&gt;&lt;BR /&gt;The answer of printf("%hd\n", s_int); is 0&lt;BR /&gt;&lt;BR /&gt;If I did&lt;BR /&gt;short s_int = 65537;&lt;BR /&gt;&lt;BR /&gt;then the answer will be 1.&lt;BR /&gt;&lt;BR /&gt;Is there a way to predict this behaviour...?&lt;BR /&gt;&lt;BR /&gt;What really happens when we overflow these int types...?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Thanks a lot to everybody in advance....&lt;BR /&gt;&lt;BR /&gt;Max</description>
      <pubDate>Tue, 03 Dec 2002 20:50:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/int-overflow/m-p/2856833#M721492</guid>
      <dc:creator>Max_4</dc:creator>
      <dc:date>2002-12-03T20:50:05Z</dc:date>
    </item>
    <item>
      <title>Re: int overflow</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/int-overflow/m-p/2856834#M721493</link>
      <description>The behavior of integer overflow is undefined although what you have found is typical. The proper way to deal with this is to use the limits found in /usr/include/limits.h which define the maximum and minimum values for vaarious data types on your platform.&lt;BR /&gt;</description>
      <pubDate>Tue, 03 Dec 2002 20:57:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/int-overflow/m-p/2856834#M721493</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2002-12-03T20:57:52Z</dc:date>
    </item>
  </channel>
</rss>

