<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: Problems with C and C++ Separate Compilation</title>
	<atom:link href="http://ahamsandwich.wordpress.com/2008/11/11/problems-with-c-and-c-separate-compilation/feed/" rel="self" type="application/rss+xml" />
	<link>http://ahamsandwich.wordpress.com/2008/11/11/problems-with-c-and-c-separate-compilation/</link>
	<description>Computer Science and Goings-On</description>
	<lastBuildDate>Wed, 15 Jul 2009 07:01:02 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: csgordon</title>
		<link>http://ahamsandwich.wordpress.com/2008/11/11/problems-with-c-and-c-separate-compilation/#comment-127</link>
		<dc:creator>csgordon</dc:creator>
		<pubDate>Fri, 21 Nov 2008 07:56:52 +0000</pubDate>
		<guid isPermaLink="false">http://ahamsandwich.wordpress.com/?p=62#comment-127</guid>
		<description>You&#039;re right, that sort of approach to APIs can certainly handle it, but that&#039;s not the solution you want.  It essentially means that every library or component, every *object file* is responsible for managing its own memory, and for providing a handle-base API for structures whose definitions it owns.  Between libraries, that&#039;s reasonable, though it adds a lot of boilerplate engineering overhead.  For separate object files within the same component, it seems like overkill.

The prefixing workaround to get de facto namespaces (which are basically syntactic sugar for prefixing; look at the symbol names compilers generate) and the automated tools for tracking dependencies by reading source also work.  I&#039;m not trying to say that these things are insurmountable; they absolutely can be managed and mitigated.  But these are problems which don&#039;t need to exist, shouldn&#039;t require workarounds and aren&#039;t present in some other languages.</description>
		<content:encoded><![CDATA[<p>You&#8217;re right, that sort of approach to APIs can certainly handle it, but that&#8217;s not the solution you want.  It essentially means that every library or component, every *object file* is responsible for managing its own memory, and for providing a handle-base API for structures whose definitions it owns.  Between libraries, that&#8217;s reasonable, though it adds a lot of boilerplate engineering overhead.  For separate object files within the same component, it seems like overkill.</p>
<p>The prefixing workaround to get de facto namespaces (which are basically syntactic sugar for prefixing; look at the symbol names compilers generate) and the automated tools for tracking dependencies by reading source also work.  I&#8217;m not trying to say that these things are insurmountable; they absolutely can be managed and mitigated.  But these are problems which don&#8217;t need to exist, shouldn&#8217;t require workarounds and aren&#8217;t present in some other languages.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dave Pacheco</title>
		<link>http://ahamsandwich.wordpress.com/2008/11/11/problems-with-c-and-c-separate-compilation/#comment-126</link>
		<dc:creator>Dave Pacheco</dc:creator>
		<pubDate>Thu, 20 Nov 2008 06:27:40 +0000</pubDate>
		<guid isPermaLink="false">http://ahamsandwich.wordpress.com/?p=62#comment-126</guid>
		<description>N makes a good point: many of these problems can be solved through careful API design. Accessor routines for user-visible data and/or stable structures allocated and freed with API calls make structure incompatibility less of an issue. You can also version API&#039;s in such a way that binary incompatibilities lead to quick init-time failures rather than arbitrary data corruption. OpenSolaris does this all over the place - see fmd_hdl_register, for one:
http://cvs.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/cmd/fm/fmd/common/fmd_api.c#fmd_hdl_register

C also has namespaces - in the form of identifier prefixes. :) It&#039;s the same thing, except unenforced and more explicit (the latter of which is a good thing).

Mark, I can&#039;t think of any language that doesn&#039;t allow developers to use relative paths for importing external modules. Such languages necessarily require a &quot;path&quot; of places where those modules might be located. This includes C, Java, Perl, Python, Ruby, .... What&#039;s the alternative?</description>
		<content:encoded><![CDATA[<p>N makes a good point: many of these problems can be solved through careful API design. Accessor routines for user-visible data and/or stable structures allocated and freed with API calls make structure incompatibility less of an issue. You can also version API&#8217;s in such a way that binary incompatibilities lead to quick init-time failures rather than arbitrary data corruption. OpenSolaris does this all over the place &#8211; see fmd_hdl_register, for one:<br />
<a href="http://cvs.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/cmd/fm/fmd/common/fmd_api.c#fmd_hdl_register" rel="nofollow">http://cvs.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/cmd/fm/fmd/common/fmd_api.c#fmd_hdl_register</a></p>
<p>C also has namespaces &#8211; in the form of identifier prefixes. <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  It&#8217;s the same thing, except unenforced and more explicit (the latter of which is a good thing).</p>
<p>Mark, I can&#8217;t think of any language that doesn&#8217;t allow developers to use relative paths for importing external modules. Such languages necessarily require a &#8220;path&#8221; of places where those modules might be located. This includes C, Java, Perl, Python, Ruby, &#8230;. What&#8217;s the alternative?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ben</title>
		<link>http://ahamsandwich.wordpress.com/2008/11/11/problems-with-c-and-c-separate-compilation/#comment-125</link>
		<dc:creator>Ben</dc:creator>
		<pubDate>Wed, 19 Nov 2008 07:03:09 +0000</pubDate>
		<guid isPermaLink="false">http://ahamsandwich.wordpress.com/?p=62#comment-125</guid>
		<description>The tool &#039;makeheaders&#039; might alleviate some of your problems,  though I haven&#039;t used it myself: http://www.hwaci.com/sw/mkhdr/</description>
		<content:encoded><![CDATA[<p>The tool &#8216;makeheaders&#8217; might alleviate some of your problems,  though I haven&#8217;t used it myself: <a href="http://www.hwaci.com/sw/mkhdr/" rel="nofollow">http://www.hwaci.com/sw/mkhdr/</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mark</title>
		<link>http://ahamsandwich.wordpress.com/2008/11/11/problems-with-c-and-c-separate-compilation/#comment-124</link>
		<dc:creator>mark</dc:creator>
		<pubDate>Wed, 19 Nov 2008 06:10:43 +0000</pubDate>
		<guid isPermaLink="false">http://ahamsandwich.wordpress.com/?p=62#comment-124</guid>
		<description>GNU autotools? The ugly and horrible macro language that people try to replace with scons or cmake since quite some time by now?

The problem is the language itself. I think namespaces should be introduced for header files as well. It is silly to require .h files to be put at specific paths rather than have it &quot;register&quot; somewhere (on a traditional system it is &quot;registered&quot; by being put at a specific place on a hdd, but this model is suboptimal imho)</description>
		<content:encoded><![CDATA[<p>GNU autotools? The ugly and horrible macro language that people try to replace with scons or cmake since quite some time by now?</p>
<p>The problem is the language itself. I think namespaces should be introduced for header files as well. It is silly to require .h files to be put at specific paths rather than have it &#8220;register&#8221; somewhere (on a traditional system it is &#8220;registered&#8221; by being put at a specific place on a hdd, but this model is suboptimal imho)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: N</title>
		<link>http://ahamsandwich.wordpress.com/2008/11/11/problems-with-c-and-c-separate-compilation/#comment-123</link>
		<dc:creator>N</dc:creator>
		<pubDate>Wed, 19 Nov 2008 05:07:37 +0000</pubDate>
		<guid isPermaLink="false">http://ahamsandwich.wordpress.com/?p=62#comment-123</guid>
		<description>This is why well designed C and C++ libraries make use of opaque pointers to data structures. It avoids the problem of having to deal with changing data layouts in your client code. As long as you work with API functions to modify opaque data in your client code, you don&#039;t need to worry about changes to the internal layout and structure of the opaque data.

&gt; It’s possible to work around this problem with a build system if you track every header file dependency explicitly.

Try GNU autotools or SCons.</description>
		<content:encoded><![CDATA[<p>This is why well designed C and C++ libraries make use of opaque pointers to data structures. It avoids the problem of having to deal with changing data layouts in your client code. As long as you work with API functions to modify opaque data in your client code, you don&#8217;t need to worry about changes to the internal layout and structure of the opaque data.</p>
<p>&gt; It’s possible to work around this problem with a build system if you track every header file dependency explicitly.</p>
<p>Try GNU autotools or SCons.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
