<?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"
	>
<channel>
	<title>Comments on: #include &#8220;irony&#8221;</title>
	<atom:link href="http://mark.santaniello.com/archives/107/feed" rel="self" type="application/rss+xml" />
	<link>http://mark.santaniello.com/archives/107</link>
	<description>the body of a very slow loop</description>
	<pubDate>Wed, 07 Jan 2009 09:21:48 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
		<item>
		<title>By: Mark</title>
		<link>http://mark.santaniello.com/archives/107#comment-430</link>
		<dc:creator>Mark</dc:creator>
		<pubDate>Sat, 29 Oct 2005 02:07:08 +0000</pubDate>
		<guid isPermaLink="false">http://mark.santaniello.net/?p=107#comment-430</guid>
		<description>Oh, and yes, I was getting a lot of comment spam, so I added the captcha.</description>
		<content:encoded><![CDATA[<p>Oh, and yes, I was getting a lot of comment spam, so I added the captcha.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mark</title>
		<link>http://mark.santaniello.com/archives/107#comment-429</link>
		<dc:creator>Mark</dc:creator>
		<pubDate>Sat, 29 Oct 2005 02:06:06 +0000</pubDate>
		<guid isPermaLink="false">http://mark.santaniello.net/?p=107#comment-429</guid>
		<description>Chris,

No, it's impossible.  What you suggest assumes that nobody will ever purposely #include something twice.  However, this is not true.  For example, consider this foo.h:

#ifdef MAKE_FOO_BE_BAR
# undef MAKE_FOO_BE_BAR
# define foo bar
#else
# undef foo
# define MAKE_FOO_BE_BAR
#endif

Now imagine a foo.c that includes this multiple times:

#include &#60;stdio.h&#62;
void foo() { printf( "foo\n" ); }
void bar() { printf( "bar\n" ); }
int main()
{
#include "foo.h"
   foo();
#include "foo.h"
   foo();
#include "foo.h"
   foo();
}

This prints:
foo
bar
foo

Admittedly, this is a contrived example.  But, I've heard of at least one assert.h which used a similar trick such to cause multiple includes to toggle assertions.  (My system's assert.h does *not* exhibit this behavior.)

-Mark</description>
		<content:encoded><![CDATA[<p>Chris,</p>
<p>No, it&#8217;s impossible.  What you suggest assumes that nobody will ever purposely #include something twice.  However, this is not true.  For example, consider this foo.h:</p>
<p>#ifdef MAKE_FOO_BE_BAR<br />
# undef MAKE_FOO_BE_BAR<br />
# define foo bar<br />
#else<br />
# undef foo<br />
# define MAKE_FOO_BE_BAR<br />
#endif</p>
<p>Now imagine a foo.c that includes this multiple times:</p>
<p>#include &lt;stdio.h&gt;<br />
void foo() { printf( &#8220;foo\n&#8221; ); }<br />
void bar() { printf( &#8220;bar\n&#8221; ); }<br />
int main()<br />
{<br />
#include &#8220;foo.h&#8221;<br />
   foo();<br />
#include &#8220;foo.h&#8221;<br />
   foo();<br />
#include &#8220;foo.h&#8221;<br />
   foo();<br />
}</p>
<p>This prints:<br />
foo<br />
bar<br />
foo</p>
<p>Admittedly, this is a contrived example.  But, I&#8217;ve heard of at least one assert.h which used a similar trick such to cause multiple includes to toggle assertions.  (My system&#8217;s assert.h does *not* exhibit this behavior.)</p>
<p>-Mark</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: molo</title>
		<link>http://mark.santaniello.com/archives/107#comment-421</link>
		<dc:creator>molo</dc:creator>
		<pubDate>Fri, 28 Oct 2005 21:49:42 +0000</pubDate>
		<guid isPermaLink="false">http://mark.santaniello.net/?p=107#comment-421</guid>
		<description>This can't be that hard.  For each #include, get the inode.  If the inode is in an existing hash, replace the #include by a blank line.  If the inode is not in the hash, this is the first time you're seeing it and can safely #include it.

-molo

PS: had problems with spam bots posting here?  whats with the capcha?</description>
		<content:encoded><![CDATA[<p>This can&#8217;t be that hard.  For each #include, get the inode.  If the inode is in an existing hash, replace the #include by a blank line.  If the inode is not in the hash, this is the first time you&#8217;re seeing it and can safely #include it.</p>
<p>-molo</p>
<p>PS: had problems with spam bots posting here?  whats with the capcha?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mark</title>
		<link>http://mark.santaniello.com/archives/107#comment-358</link>
		<dc:creator>Mark</dc:creator>
		<pubDate>Thu, 27 Oct 2005 22:16:06 +0000</pubDate>
		<guid isPermaLink="false">http://mark.santaniello.net/?p=107#comment-358</guid>
		<description>David,

No, I haven't, but mostly because I need to #include "windows.h" , etc, and I have no idea how to use MinGW or Cygnus to do this with gcc on Windows.

From reading the man page, it sounds rather similar to VisualC's -P switch.  In other words, it gives me the preprocessed output file.  What I wanted, but later discovered was impossible, was to only process #include directives, and leave all the #ifdef stuff alone.  

-Mark</description>
		<content:encoded><![CDATA[<p>David,</p>
<p>No, I haven&#8217;t, but mostly because I need to #include &#8220;windows.h&#8221; , etc, and I have no idea how to use MinGW or Cygnus to do this with gcc on Windows.</p>
<p>From reading the man page, it sounds rather similar to VisualC&#8217;s -P switch.  In other words, it gives me the preprocessed output file.  What I wanted, but later discovered was impossible, was to only process #include directives, and leave all the #ifdef stuff alone.  </p>
<p>-Mark</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David Bremner</title>
		<link>http://mark.santaniello.com/archives/107#comment-331</link>
		<dc:creator>David Bremner</dc:creator>
		<pubDate>Wed, 26 Oct 2005 21:09:57 +0000</pubDate>
		<guid isPermaLink="false">http://mark.santaniello.net/?p=107#comment-331</guid>
		<description>Mark,

have you tried using gcc -save-temps?</description>
		<content:encoded><![CDATA[<p>Mark,</p>
<p>have you tried using gcc -save-temps?</p>
]]></content:encoded>
	</item>
</channel>
</rss>
