<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments for Hard to C</title>
	<atom:link href="http://www.hardtoc.com/comments/feed" rel="self" type="application/rss+xml" />
	<link>http://www.hardtoc.com</link>
	<description>Look and you will C -- Learn and you will C++</description>
	<lastBuildDate>Thu, 08 Sep 2011 08:10:55 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>Comment on INT_MIN by David</title>
		<link>http://www.hardtoc.com/archives/119/comment-page-1#comment-2552</link>
		<dc:creator>David</dc:creator>
		<pubDate>Thu, 08 Sep 2011 08:10:55 +0000</pubDate>
		<guid isPermaLink="false">http://www.hardtoc.com/?p=119#comment-2552</guid>
		<description>Oops. I need to read harder. :(</description>
		<content:encoded><![CDATA[<p>Oops. I need to read harder. <img src='http://www.hardtoc.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on INT_MIN by David</title>
		<link>http://www.hardtoc.com/archives/119/comment-page-1#comment-2551</link>
		<dc:creator>David</dc:creator>
		<pubDate>Thu, 08 Sep 2011 08:09:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.hardtoc.com/?p=119#comment-2551</guid>
		<description>Typo: (-32766 – 1)</description>
		<content:encoded><![CDATA[<p>Typo: (-32766 – 1)</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on INT_MIN by Robin</title>
		<link>http://www.hardtoc.com/archives/119/comment-page-1#comment-2550</link>
		<dc:creator>Robin</dc:creator>
		<pubDate>Thu, 08 Sep 2011 07:57:41 +0000</pubDate>
		<guid isPermaLink="false">http://www.hardtoc.com/?p=119#comment-2550</guid>
		<description>@ Peter Hamilton

Because you&#039;re compiling it as a 64-bit application on your 64-bit OS. The article is pointing out a 32-bit problem. If you compile the source code with &quot;-arch i386&quot;, forcing it as a 32-bit executable, the test will work.</description>
		<content:encoded><![CDATA[<p>@ Peter Hamilton</p>
<p>Because you&#8217;re compiling it as a 64-bit application on your 64-bit OS. The article is pointing out a 32-bit problem. If you compile the source code with &#8220;-arch i386&#8243;, forcing it as a 32-bit executable, the test will work.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on INT_MIN by Jibz</title>
		<link>http://www.hardtoc.com/archives/119/comment-page-1#comment-2549</link>
		<dc:creator>Jibz</dc:creator>
		<pubDate>Thu, 08 Sep 2011 05:35:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.hardtoc.com/?p=119#comment-2549</guid>
		<description>Thank you for the comments (even if the post is a few years old, I believe the issue remains).

Peter, normally I would expect GCC to default to C89 (with extensions) which should show &#039;positive&#039;. I wonder if it being a LLVM version makes a difference?

Josh, that is an interesting observation, thanks for the link!

lowell, it looks like clang follows the C99 standard mostly, so the output is expected, but it is a bit surprising it does not produce any warnings at all.</description>
		<content:encoded><![CDATA[<p>Thank you for the comments (even if the post is a few years old, I believe the issue remains).</p>
<p>Peter, normally I would expect GCC to default to C89 (with extensions) which should show &#8216;positive&#8217;. I wonder if it being a LLVM version makes a difference?</p>
<p>Josh, that is an interesting observation, thanks for the link!</p>
<p>lowell, it looks like clang follows the C99 standard mostly, so the output is expected, but it is a bit surprising it does not produce any warnings at all.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on INT_MIN by lowell</title>
		<link>http://www.hardtoc.com/archives/119/comment-page-1#comment-2546</link>
		<dc:creator>lowell</dc:creator>
		<pubDate>Thu, 08 Sep 2011 01:34:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.hardtoc.com/?p=119#comment-2546</guid>
		<description>WTF; NM. This was on HN so I thought it was new; didn&#039;t notice the 2009 dates on the comments or the post itself.</description>
		<content:encoded><![CDATA[<p>WTF; NM. This was on HN so I thought it was new; didn&#8217;t notice the 2009 dates on the comments or the post itself.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on INT_MIN by lowell</title>
		<link>http://www.hardtoc.com/archives/119/comment-page-1#comment-2545</link>
		<dc:creator>lowell</dc:creator>
		<pubDate>Thu, 08 Sep 2011 01:32:56 +0000</pubDate>
		<guid isPermaLink="false">http://www.hardtoc.com/?p=119#comment-2545</guid>
		<description>Clang in OS X Lion 10.7.2:

    $ clang signed.c -o signed -Wall
    $ ./signed 
    negative
    equal
    floating</description>
		<content:encoded><![CDATA[<p>Clang in OS X Lion 10.7.2:</p>
<p>    $ clang signed.c -o signed -Wall<br />
    $ ./signed<br />
    negative<br />
    equal<br />
    floating</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on INT_MIN by foolhunger</title>
		<link>http://www.hardtoc.com/archives/119/comment-page-1#comment-2544</link>
		<dc:creator>foolhunger</dc:creator>
		<pubDate>Thu, 08 Sep 2011 00:55:10 +0000</pubDate>
		<guid isPermaLink="false">http://www.hardtoc.com/?p=119#comment-2544</guid>
		<description>Great! I have saw this on CSAPP before, and the C99 output surprised me:)</description>
		<content:encoded><![CDATA[<p>Great! I have saw this on CSAPP before, and the C99 output surprised me:)</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on INT_MIN by sdfghj</title>
		<link>http://www.hardtoc.com/archives/119/comment-page-1#comment-2543</link>
		<dc:creator>sdfghj</dc:creator>
		<pubDate>Wed, 07 Sep 2011 23:52:42 +0000</pubDate>
		<guid isPermaLink="false">http://www.hardtoc.com/?p=119#comment-2543</guid>
		<description>print(&quot;%d\n&quot;, -2147483648 &lt; 0);
print(&quot;%d\n&quot;, (unsigned int)-2147483648 &lt; 0);
print(&quot;%d\n&quot;, (int)-2147483648 &lt; 0);
print(&quot;%d\n&quot;, (long)-2147483648 &lt; 0);
print(&quot;%d\n&quot;, (unsigned long)-2147483648 &lt; 0);
print(&quot;%d\n&quot;, -2147483647 - 1 &lt; 0);

When compiled with Ken Thompson&#039;s C compiler for the 386, the above program prints the following output:

0
0
1
1
0
1</description>
		<content:encoded><![CDATA[<p>print(&#8220;%d\n&#8221;, -2147483648 &lt; 0);<br />
print(&quot;%d\n&quot;, (unsigned int)-2147483648 &lt; 0);<br />
print(&quot;%d\n&quot;, (int)-2147483648 &lt; 0);<br />
print(&quot;%d\n&quot;, (long)-2147483648 &lt; 0);<br />
print(&quot;%d\n&quot;, (unsigned long)-2147483648 &lt; 0);<br />
print(&quot;%d\n&quot;, -2147483647 &#8211; 1 &lt; 0);</p>
<p>When compiled with Ken Thompson&#039;s C compiler for the 386, the above program prints the following output:</p>
<p>0<br />
0<br />
1<br />
1<br />
0<br />
1</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on INT_MIN by Josh Haberman</title>
		<link>http://www.hardtoc.com/archives/119/comment-page-1#comment-2542</link>
		<dc:creator>Josh Haberman</dc:creator>
		<pubDate>Wed, 07 Sep 2011 23:49:38 +0000</pubDate>
		<guid isPermaLink="false">http://www.hardtoc.com/?p=119#comment-2542</guid>
		<description>This bit of asymmetry also leads to this interesting security implication: http://my.opera.com/taviso/blog/show.dml/639454

(In short, (INT_MIN / -1) can crash your program with an exception, since the result can&#039;t be represented in an integer.  It&#039;s an easy way to crash a program that does integer math on untrusted input.</description>
		<content:encoded><![CDATA[<p>This bit of asymmetry also leads to this interesting security implication: <a href="http://my.opera.com/taviso/blog/show.dml/639454" rel="nofollow">http://my.opera.com/taviso/blog/show.dml/639454</a></p>
<p>(In short, (INT_MIN / -1) can crash your program with an exception, since the result can&#8217;t be represented in an integer.  It&#8217;s an easy way to crash a program that does integer math on untrusted input.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on INT_MIN by Peter Hamilton</title>
		<link>http://www.hardtoc.com/archives/119/comment-page-1#comment-2541</link>
		<dc:creator>Peter Hamilton</dc:creator>
		<pubDate>Wed, 07 Sep 2011 23:19:19 +0000</pubDate>
		<guid isPermaLink="false">http://www.hardtoc.com/?p=119#comment-2541</guid>
		<description>Running on a Mac only prints negative, equal and floating.


melker:Programming peter$ gcc -v
Using built-in specs.
Target: i686-apple-darwin11
Configured with: /private/var/tmp/llvmgcc42/llvmgcc42-2335.15~25/src/configure --disable-checking --enable-werror --prefix=/Developer/usr/llvm-gcc-4.2 --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-prefix=llvm- --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin11 --enable-llvm=/private/var/tmp/llvmgcc42/llvmgcc42-2335.15~25/dst-llvmCore/Developer/usr/local --program-prefix=i686-apple-darwin11- --host=x86_64-apple-darwin11 --target=i686-apple-darwin11 --with-gxx-include-dir=/usr/include/c++/4.2.1
Thread model: posix
gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)
melker:Programming peter$ ./a.out 
negative
equal
floating
melker:Programming peter$</description>
		<content:encoded><![CDATA[<p>Running on a Mac only prints negative, equal and floating.</p>
<p>melker:Programming peter$ gcc -v<br />
Using built-in specs.<br />
Target: i686-apple-darwin11<br />
Configured with: /private/var/tmp/llvmgcc42/llvmgcc42-2335.15~25/src/configure &#8211;disable-checking &#8211;enable-werror &#8211;prefix=/Developer/usr/llvm-gcc-4.2 &#8211;mandir=/share/man &#8211;enable-languages=c,objc,c++,obj-c++ &#8211;program-prefix=llvm- &#8211;program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ &#8211;with-slibdir=/usr/lib &#8211;build=i686-apple-darwin11 &#8211;enable-llvm=/private/var/tmp/llvmgcc42/llvmgcc42-2335.15~25/dst-llvmCore/Developer/usr/local &#8211;program-prefix=i686-apple-darwin11- &#8211;host=x86_64-apple-darwin11 &#8211;target=i686-apple-darwin11 &#8211;with-gxx-include-dir=/usr/include/c++/4.2.1<br />
Thread model: posix<br />
gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)<br />
melker:Programming peter$ ./a.out<br />
negative<br />
equal<br />
floating<br />
melker:Programming peter$</p>
]]></content:encoded>
	</item>
</channel>
</rss>

