<?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 for Daily C++</title>
	<atom:link href="http://108leaves.com/dailyc++/?feed=comments-rss2" rel="self" type="application/rss+xml" />
	<link>http://108leaves.com/dailyc++</link>
	<description>Only C++</description>
	<pubDate>Mon, 06 Sep 2010 00:24:36 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
		<item>
		<title>Comment on To use pthreads with C++ : by Nate</title>
		<link>http://108leaves.com/dailyc++/?p=5#comment-10</link>
		<dc:creator>Nate</dc:creator>
		<pubDate>Tue, 09 Sep 2008 23:37:16 +0000</pubDate>
		<guid isPermaLink="false">http://108leaves.com/dailyc++/?p=5#comment-10</guid>
		<description>C++, Isn't that the hardest Programming language out there?!? Even VB is giving me a headache. 0.O</description>
		<content:encoded><![CDATA[<p>C++, Isn&#8217;t that the hardest Programming language out there?!? Even VB is giving me a headache. 0.O</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on The Monitor pattern vs the Monitor programming construct by admin</title>
		<link>http://108leaves.com/dailyc++/?p=4#comment-8</link>
		<dc:creator>admin</dc:creator>
		<pubDate>Tue, 05 Aug 2008 11:30:14 +0000</pubDate>
		<guid isPermaLink="false">http://108leaves.com/dailyc++/?p=4#comment-8</guid>
		<description>Thanks Sachin for your comments. Thats true - guys like Herb Sutter are working hard on this (how to optimize multi-core). These are like short notes - so that I can check them whenever I need to remember something.</description>
		<content:encoded><![CDATA[<p>Thanks Sachin for your comments. Thats true - guys like Herb Sutter are working hard on this (how to optimize multi-core). These are like short notes - so that I can check them whenever I need to remember something.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on The Monitor pattern vs the Monitor programming construct by sachin</title>
		<link>http://108leaves.com/dailyc++/?p=4#comment-7</link>
		<dc:creator>sachin</dc:creator>
		<pubDate>Sun, 03 Aug 2008 03:36:17 +0000</pubDate>
		<guid isPermaLink="false">http://108leaves.com/dailyc++/?p=4#comment-7</guid>
		<description>I must say that i am impressed at the level of detail provided above. Please continue writing such articles. Even though we have  better faster SMP and Multi-threaded CPU cores, we dont have the coding skills to utilize the power of such hardware. we are just embarking on such grounds (atleast in cases of networking applications).</description>
		<content:encoded><![CDATA[<p>I must say that i am impressed at the level of detail provided above. Please continue writing such articles. Even though we have  better faster SMP and Multi-threaded CPU cores, we dont have the coding skills to utilize the power of such hardware. we are just embarking on such grounds (atleast in cases of networking applications).</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on To use pthreads with C++ : by Milton</title>
		<link>http://108leaves.com/dailyc++/?p=5#comment-6</link>
		<dc:creator>Milton</dc:creator>
		<pubDate>Tue, 29 Jul 2008 12:22:32 +0000</pubDate>
		<guid isPermaLink="false">http://108leaves.com/dailyc++/?p=5#comment-6</guid>
		<description>Hi Samuel,
Yes, but if you want write a piece of code without any portability issue then it is advisable that you keep the start function under extern c. 

Cheers,
Milton</description>
		<content:encoded><![CDATA[<p>Hi Samuel,<br />
Yes, but if you want write a piece of code without any portability issue then it is advisable that you keep the start function under extern c. </p>
<p>Cheers,<br />
Milton</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on To use pthreads with C++ : by Mukta</title>
		<link>http://108leaves.com/dailyc++/?p=5#comment-4</link>
		<dc:creator>Mukta</dc:creator>
		<pubDate>Tue, 08 Jul 2008 21:08:50 +0000</pubDate>
		<guid isPermaLink="false">http://108leaves.com/dailyc++/?p=5#comment-4</guid>
		<description>Hey this was very useful! Thanks ,  would love to see more posts!</description>
		<content:encoded><![CDATA[<p>Hey this was very useful! Thanks ,  would love to see more posts!</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on To use pthreads with C++ : by R Samuel Klatchko</title>
		<link>http://108leaves.com/dailyc++/?p=5#comment-3</link>
		<dc:creator>R Samuel Klatchko</dc:creator>
		<pubDate>Fri, 04 Jul 2008 06:01:41 +0000</pubDate>
		<guid isPermaLink="false">http://108leaves.com/dailyc++/?p=5#comment-3</guid>
		<description>&lt;I&gt;we have to remember that startFunction is a c function - hence no namemangling is allowed there&lt;/i&gt;

That's not quite correct.  Unless you are doing explicit dynamic linking (i.e. dlopen/dlsym), name mangling is not an issue.  Provided both the startFunction and the call to pthread_create are both in C++ compiled code, the compiler/linker can handle name mangling.

What could cause a problem is the calling convention of C++ functions as opposed to C functions (the calling convention handles issues such as how arguments are passed and the stack is manipulated between the caller and the callee).  A C++ compiler is allowed to use a different calling convention for C++ functions and C functions.  Since pthread_create() expects the startFunction to use the C calling convention, you can run into trouble.

That said, all the compilers I am familiar with (gcc, Intel, Sun) use the same calling convention for C++ and C code.  I have successfully had pthread_create() use a non extern "C" function as the start function.

That said, you cannot use a member function as it does have a different calling convention (the implicit this pointer).  But as long as the function is a static member function or a free function, you do not need to use extern "C".</description>
		<content:encoded><![CDATA[<p><i>we have to remember that startFunction is a c function - hence no namemangling is allowed there</i></p>
<p>That&#8217;s not quite correct.  Unless you are doing explicit dynamic linking (i.e. dlopen/dlsym), name mangling is not an issue.  Provided both the startFunction and the call to pthread_create are both in C++ compiled code, the compiler/linker can handle name mangling.</p>
<p>What could cause a problem is the calling convention of C++ functions as opposed to C functions (the calling convention handles issues such as how arguments are passed and the stack is manipulated between the caller and the callee).  A C++ compiler is allowed to use a different calling convention for C++ functions and C functions.  Since pthread_create() expects the startFunction to use the C calling convention, you can run into trouble.</p>
<p>That said, all the compilers I am familiar with (gcc, Intel, Sun) use the same calling convention for C++ and C code.  I have successfully had pthread_create() use a non extern &#8220;C&#8221; function as the start function.</p>
<p>That said, you cannot use a member function as it does have a different calling convention (the implicit this pointer).  But as long as the function is a static member function or a free function, you do not need to use extern &#8220;C&#8221;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on To use pthreads with C++ : by Linoleum</title>
		<link>http://108leaves.com/dailyc++/?p=5#comment-2</link>
		<dc:creator>Linoleum</dc:creator>
		<pubDate>Thu, 03 Jul 2008 21:38:05 +0000</pubDate>
		<guid isPermaLink="false">http://108leaves.com/dailyc++/?p=5#comment-2</guid>
		<description>&lt;strong&gt;Using pthreads in C++...&lt;/strong&gt;

The Daily C++ weblog has posted a short piece on using pthreads in C++....</description>
		<content:encoded><![CDATA[<p><strong>Using pthreads in C++&#8230;</strong></p>
<p>The Daily C++ weblog has posted a short piece on using pthreads in C++&#8230;.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
