<?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 on: Stupid C++ Tricks: Adventures in Assert</title>
	<atom:link href="http://cnicholson.net/2009/02/stupid-c-tricks-adventures-in-assert/feed/" rel="self" type="application/rss+xml" />
	<link>http://cnicholson.net/2009/02/stupid-c-tricks-adventures-in-assert/</link>
	<description>programming is hard.</description>
	<lastBuildDate>Sun, 05 Feb 2012 15:43:05 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: ColorIt &#124; Fatal Abstraction</title>
		<link>http://cnicholson.net/2009/02/stupid-c-tricks-adventures-in-assert/comment-page-1/#comment-183</link>
		<dc:creator>ColorIt &#124; Fatal Abstraction</dc:creator>
		<pubDate>Sun, 05 Feb 2012 15:43:05 +0000</pubDate>
		<guid isPermaLink="false">http://cnicholson.net/?p=3#comment-183</guid>
		<description>[...] such as a tracing heap allocator, static and run-time assertions (thanks Niklas Frykholm, Charles Nicholson and Tom Forsyth) as well as logging of various debug-streams to [...]</description>
		<content:encoded><![CDATA[<p>[...] such as a tracing heap allocator, static and run-time assertions (thanks Niklas Frykholm, Charles Nicholson and Tom Forsyth) as well as logging of various debug-streams to [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Frosty</title>
		<link>http://cnicholson.net/2009/02/stupid-c-tricks-adventures-in-assert/comment-page-1/#comment-138</link>
		<dc:creator>Frosty</dc:creator>
		<pubDate>Tue, 27 Sep 2011 21:36:07 +0000</pubDate>
		<guid isPermaLink="false">http://cnicholson.net/?p=3#comment-138</guid>
		<description>The &quot;(void)sizeof(x)&quot; trick does no longer work in VS2010, which is a pity because I use it all of the time.
Does anyone know a replacement that accomplishes the same?</description>
		<content:encoded><![CDATA[<p>The &#8220;(void)sizeof(x)&#8221; trick does no longer work in VS2010, which is a pity because I use it all of the time.<br />
Does anyone know a replacement that accomplishes the same?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Assert - Pulsar Engine</title>
		<link>http://cnicholson.net/2009/02/stupid-c-tricks-adventures-in-assert/comment-page-1/#comment-84</link>
		<dc:creator>Assert - Pulsar Engine</dc:creator>
		<pubDate>Sat, 21 Aug 2010 09:50:23 +0000</pubDate>
		<guid isPermaLink="false">http://cnicholson.net/?p=3#comment-84</guid>
		<description>[...] I give you for this is outlined in a post about Assert from they guys at Power of Two Games: Stupid C++ Tricks: Adventures in Assert). Briefly, you need to test that an assertion thrown you will need to add some additional hooks [...]</description>
		<content:encoded><![CDATA[<p>[...] I give you for this is outlined in a post about Assert from they guys at Power of Two Games: Stupid C++ Tricks: Adventures in Assert). Briefly, you need to test that an assertion thrown you will need to add some additional hooks [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Danny Parker</title>
		<link>http://cnicholson.net/2009/02/stupid-c-tricks-adventures-in-assert/comment-page-1/#comment-82</link>
		<dc:creator>Danny Parker</dc:creator>
		<pubDate>Thu, 29 Jul 2010 15:01:37 +0000</pubDate>
		<guid isPermaLink="false">http://cnicholson.net/?p=3#comment-82</guid>
		<description>This page is a great source of general information not just about asserts. I reference it often.

So when I saw this i thought I should return the favour:

http://www.jaggersoft.com/pubs/CVu11_3.html

: D</description>
		<content:encoded><![CDATA[<p>This page is a great source of general information not just about asserts. I reference it often.</p>
<p>So when I saw this i thought I should return the favour:</p>
<p><a href="http://www.jaggersoft.com/pubs/CVu11_3.html" rel="nofollow">http://www.jaggersoft.com/pubs/CVu11_3.html</a></p>
<p>: D</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: GameCoder.it &#8722; L&#8217;assert, questa sconosciuta</title>
		<link>http://cnicholson.net/2009/02/stupid-c-tricks-adventures-in-assert/comment-page-1/#comment-77</link>
		<dc:creator>GameCoder.it &#8722; L&#8217;assert, questa sconosciuta</dc:creator>
		<pubDate>Sun, 28 Feb 2010 21:59:27 +0000</pubDate>
		<guid isPermaLink="false">http://cnicholson.net/?p=3#comment-77</guid>
		<description>[...] articolo di JP sulle nuove assert statiche del C++0x. riferimenti: http://cnicholson.net/2009/02/stupid-c-tricks-adventures-in-assert/ http://msinilo.pl/blog/?p=212   Share and [...]</description>
		<content:encoded><![CDATA[<p>[...] articolo di JP sulle nuove assert statiche del C++0x. riferimenti: <a href="http://cnicholson.net/2009/02/stupid-c-tricks-adventures-in-assert/" rel="nofollow">http://cnicholson.net/2009/02/stupid-c-tricks-adventures-in-assert/</a> <a href="http://msinilo.pl/blog/?p=212" rel="nofollow">http://msinilo.pl/blog/?p=212</a>   Share and [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jan Řrřola Kadlec</title>
		<link>http://cnicholson.net/2009/02/stupid-c-tricks-adventures-in-assert/comment-page-1/#comment-74</link>
		<dc:creator>Jan Řrřola Kadlec</dc:creator>
		<pubDate>Tue, 12 Jan 2010 14:30:28 +0000</pubDate>
		<guid isPermaLink="false">http://cnicholson.net/?p=3#comment-74</guid>
		<description>Thanks everyone for the article and comments. This is how my C/C++ assert macros look like now:

#include 

typedef int (*AssertHandler)(char const*, char const*, int);

int default_assert_handler(char const* expr, char const* file, int line)
{ fprintf(stderr, &quot;Assertion (%s) failed in %s (%d)\n&quot;, expr, file, line);
  return 1;
}

AssertHandler assert_handler = default_assert_handler;

#if defined(_MSC_VER)
  #define ASSERT_HALT() __debugbreak()
#else
  #include 
  #define ASSERT_HALT() exit(__LINE__)
#endif

#ifdef DEBUG
  #define assert(x) ((void)(!(x) &amp;&amp; assert_handler(#x, __FILE__, __LINE__) &amp;&amp; (ASSERT_HALT(), 1)))
#else
  #define assert(x) ((void)sizeof(x))
#endif</description>
		<content:encoded><![CDATA[<p>Thanks everyone for the article and comments. This is how my C/C++ assert macros look like now:</p>
<p>#include </p>
<p>typedef int (*AssertHandler)(char const*, char const*, int);</p>
<p>int default_assert_handler(char const* expr, char const* file, int line)<br />
{ fprintf(stderr, &#8220;Assertion (%s) failed in %s (%d)\n&#8221;, expr, file, line);<br />
  return 1;<br />
}</p>
<p>AssertHandler assert_handler = default_assert_handler;</p>
<p>#if defined(_MSC_VER)<br />
  #define ASSERT_HALT() __debugbreak()<br />
#else<br />
  #include<br />
  #define ASSERT_HALT() exit(__LINE__)<br />
#endif</p>
<p>#ifdef DEBUG<br />
  #define assert(x) ((void)(!(x) &amp;&amp; assert_handler(#x, __FILE__, __LINE__) &amp;&amp; (ASSERT_HALT(), 1)))<br />
#else<br />
  #define assert(x) ((void)sizeof(x))<br />
#endif</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kevin Wentzell</title>
		<link>http://cnicholson.net/2009/02/stupid-c-tricks-adventures-in-assert/comment-page-1/#comment-73</link>
		<dc:creator>Kevin Wentzell</dc:creator>
		<pubDate>Sat, 02 Jan 2010 07:00:36 +0000</pubDate>
		<guid isPermaLink="false">http://cnicholson.net/?p=3#comment-73</guid>
		<description>THANK YOU SO MUCH! I was in the middle of banging my head down to a few thousand lines of code when I stumbled upon your page. The problem:

#define ASSERT( n )\
        if ( !n )\
        {\
            return;\
        }

and eventually got a hint when this code wasn&#039;t returning from the block:

ASSERT( 2 &gt; 2 )

Thank you &gt;.&lt;</description>
		<content:encoded><![CDATA[<p>THANK YOU SO MUCH! I was in the middle of banging my head down to a few thousand lines of code when I stumbled upon your page. The problem:</p>
<p>#define ASSERT( n )\<br />
        if ( !n )\<br />
        {\<br />
            return;\<br />
        }</p>
<p>and eventually got a hint when this code wasn&#8217;t returning from the block:</p>
<p>ASSERT( 2 &gt; 2 )</p>
<p>Thank you &gt;.&lt;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris</title>
		<link>http://cnicholson.net/2009/02/stupid-c-tricks-adventures-in-assert/comment-page-1/#comment-69</link>
		<dc:creator>Chris</dc:creator>
		<pubDate>Thu, 17 Dec 2009 23:35:40 +0000</pubDate>
		<guid isPermaLink="false">http://cnicholson.net/?p=3#comment-69</guid>
		<description>Just a note that (at least under the version I&#039;m using) __builtin_trap() in GCC works like __debugbreak().  I&#039;m finding this real handy with Xilinx&#039;s GDB-based debugger for the PowerPC405 on their Virtex-4 FPGAs.  Thanks!</description>
		<content:encoded><![CDATA[<p>Just a note that (at least under the version I&#8217;m using) __builtin_trap() in GCC works like __debugbreak().  I&#8217;m finding this real handy with Xilinx&#8217;s GDB-based debugger for the PowerPC405 on their Virtex-4 FPGAs.  Thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anthony Whitaker</title>
		<link>http://cnicholson.net/2009/02/stupid-c-tricks-adventures-in-assert/comment-page-1/#comment-66</link>
		<dc:creator>Anthony Whitaker</dc:creator>
		<pubDate>Sat, 21 Nov 2009 00:30:33 +0000</pubDate>
		<guid isPermaLink="false">http://cnicholson.net/?p=3#comment-66</guid>
		<description>I&#039;ve found that the code below does a decent job on several compilers at silencing that pesky constant conditional expression warning.

// This is simply not enough on some compilers.
do {} while(__LINE__ == -1)

Instead I use these macros to surround multi-line macros.
#define GorkMacroOpen do {
#define GorkMacroClose } while(__LINE__ == -1, false)

Looking forward to more articles Charles :)  
It&#039;s time to update</description>
		<content:encoded><![CDATA[<p>I&#8217;ve found that the code below does a decent job on several compilers at silencing that pesky constant conditional expression warning.</p>
<p>// This is simply not enough on some compilers.<br />
do {} while(__LINE__ == -1)</p>
<p>Instead I use these macros to surround multi-line macros.<br />
#define GorkMacroOpen do {<br />
#define GorkMacroClose } while(__LINE__ == -1, false)</p>
<p>Looking forward to more articles Charles <img src='http://cnicholson.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
It&#8217;s time to update</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: cyberursus</title>
		<link>http://cnicholson.net/2009/02/stupid-c-tricks-adventures-in-assert/comment-page-1/#comment-63</link>
		<dc:creator>cyberursus</dc:creator>
		<pubDate>Sun, 04 Oct 2009 16:43:31 +0000</pubDate>
		<guid isPermaLink="false">http://cnicholson.net/?p=3#comment-63</guid>
		<description>The following code

#define NDEBUG 1

#include 

int main()
{
	bool failed = false;
	assert(failed);
}

shows &#039;unused variable&#039; warning for both GCC and MSVC...</description>
		<content:encoded><![CDATA[<p>The following code</p>
<p>#define NDEBUG 1</p>
<p>#include </p>
<p>int main()<br />
{<br />
	bool failed = false;<br />
	assert(failed);<br />
}</p>
<p>shows &#8216;unused variable&#8217; warning for both GCC and MSVC&#8230;</p>
]]></content:encoded>
	</item>
</channel>
</rss>

