<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>SafeInt Compiles on gcc!</title><link>http://blogs.msdn.com/b/david_leblanc/archive/2008/11/25/safeint-compiles-on-gcc.aspx</link><description>[update 12-1-08] I now have it completely compiling on gcc, with a test harness that exercises every method of the class for every combination of types (all 15 of them). Version 3.0.12p is now moved to release status. 
 Once I got SafeInt posted on CodePlex</description><dc:language>en-US</dc:language><generator>Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><item><title>MSDN FLASH IRELAND - INTERNATIONAL RESOURCES - 18 DECEMBER 2008 </title><link>http://blogs.msdn.com/b/david_leblanc/archive/2008/11/25/safeint-compiles-on-gcc.aspx#9236834</link><pubDate>Thu, 18 Dec 2008 22:07:47 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9236834</guid><dc:creator>Microsoft Ireland Blog</dc:creator><description>&lt;p&gt;a {color : #0033CC;} a:link {color: #0033CC;} a:visited.local {color: #0033CC;} a:visited {color : #800080;}&lt;/p&gt;
&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9236834" width="1" height="1"&gt;</description></item><item><title>re: SafeInt Compiles on gcc!</title><link>http://blogs.msdn.com/b/david_leblanc/archive/2008/11/25/safeint-compiles-on-gcc.aspx#9148410</link><pubDate>Fri, 28 Nov 2008 01:21:38 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9148410</guid><dc:creator>Niels Dekker</dc:creator><description>&lt;p&gt;Thanks for naming me so many times, David! &amp;nbsp;:-) &amp;nbsp;I think that SafeInt is a _very_ useful tool, helping to write code correctly, and increasing software security. So I hope it will be widespread, on many platforms... &amp;nbsp;Here at the LKEB Division of Image Processing, LUMC, Leiden (www.lkeb.nl), we develop software for both Windows and Linux, so it's very important for us to have SafeInt GCC compliant.&lt;/p&gt;
&lt;p&gt;Kind regards, Niels&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9148410" width="1" height="1"&gt;</description></item><item><title>re: SafeInt Compiles on gcc!</title><link>http://blogs.msdn.com/b/david_leblanc/archive/2008/11/25/safeint-compiles-on-gcc.aspx#9143435</link><pubDate>Wed, 26 Nov 2008 11:00:28 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9143435</guid><dc:creator>int19h</dc:creator><description>&lt;P&gt;&amp;gt; The Visual Studio compiler will do the right thing if you're dealing with a native type – like unsigned int – and go ahead and discard the cast and modify the argument as you'd expect.&lt;/P&gt;
&lt;P&gt;Surely, if it does not behave according to the Standard, it's not doing "the right thing"?&lt;/P&gt;
&lt;P&gt;[dcl] It's often the case that a standard either allows some room for interpretation, or diverging from it slightly is really a desirable outcome. For example, the RFC for FTP requires support for redirecting the data stream to a 3rd server. This used to have a real use. Now it is used for attacking people and no one implements it any more - haven't for years. &lt;/P&gt;
&lt;P&gt;In this case, you wrote a function taking a non-const reference, which you clearly meant to be modified. There isn't any scenario I can think of where you'd really have wanted the temp copy to be modified. As I pointed out, I do think it is a serious flaw that you don't get a warning out of this, but I can't argue that ignoring a no-op cast to a&amp;nbsp;simple type is really a problem. My review of the standard does not show an explicit statement (see section 8.3.2) of exactly how this ought to behave, though one could argue that the casting specification does provide that a temp value ought to be created, but nowhere does it say how a temp value passed as a reference ought to behave. If there is lack of clear guidance from the standard, then it is reasonable to expect behavior to be implementation dependent, which we as programmers would like to avoid, but I can't criticize an implementation for trying to capture programmer intent. As it turns out, the Microsoft compiler does complain if you disable the Microsoft extensions, so this is reasonable. As I stated, I do believe that we should get a warning over this, as the behavior with complex types is not what a programmer would expect. Additionally, the standard ought to make this behavior explicit (IMHO, it should be an error).&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9143435" width="1" height="1"&gt;</description></item><item><title>infoblog &amp;raquo; SafeInt Compiles on gcc!</title><link>http://blogs.msdn.com/b/david_leblanc/archive/2008/11/25/safeint-compiles-on-gcc.aspx#9143251</link><pubDate>Wed, 26 Nov 2008 07:16:40 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9143251</guid><dc:creator>infoblog &amp;raquo; SafeInt Compiles on gcc!</dc:creator><description>&lt;p&gt;PingBack from &lt;a rel="nofollow" target="_new" href="http://blog.a-foton.ru/index.php/2008/11/26/safeint-compiles-on-gcc/"&gt;http://blog.a-foton.ru/index.php/2008/11/26/safeint-compiles-on-gcc/&lt;/a&gt;&lt;/p&gt;
&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9143251" width="1" height="1"&gt;</description></item></channel></rss>