<?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>评论：C和C++处理register关键字的一处差异</title>
	<atom:link href="http://blog.linjian.org/articles/c-cpp-register-difference/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.linjian.org/articles/c-cpp-register-difference/</link>
	<description>有容乃大，无欲则刚</description>
	<lastBuildDate>Wed, 10 Mar 2010 11:08:11 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>来自：LOL LOL</title>
		<link>http://blog.linjian.org/articles/c-cpp-register-difference/comment-page-1/#comment-241</link>
		<dc:creator>LOL LOL</dc:creator>
		<pubDate>Fri, 05 Jun 2009 05:19:33 +0000</pubDate>
		<guid isPermaLink="false">http://blog.linjian.org/?p=330#comment-241</guid>
		<description>我不明白你们为什么会认为这（就像C++放宽的许多其它限制一样）影响了兼容性。C++只要求能“向后兼容”C代码，即C代码可以方便地移植到C++下。而放宽限制不影响兼容性——使用register关键字的C代码可以在C++下正确编译通过（排除其他因素的干扰）。</description>
		<content:encoded><![CDATA[<p>我不明白你们为什么会认为这（就像C++放宽的许多其它限制一样）影响了兼容性。C++只要求能“向后兼容”C代码，即C代码可以方便地移植到C++下。而放宽限制不影响兼容性——使用register关键字的C代码可以在C++下正确编译通过（排除其他因素的干扰）。</p>
]]></content:encoded>
	</item>
	<item>
		<title>来自：Jian Lin</title>
		<link>http://blog.linjian.org/articles/c-cpp-register-difference/comment-page-1/#comment-133</link>
		<dc:creator>Jian Lin</dc:creator>
		<pubDate>Thu, 30 Apr 2009 11:55:07 +0000</pubDate>
		<guid isPermaLink="false">http://blog.linjian.org/?p=330#comment-133</guid>
		<description>是的，我看过标准，文中也引用了标准中的部分文字。C和C++中register的语义是明确且不同的。

我是想说，二者这种差异的原因是什么？C++在这个问题上为什么不与C兼容？
Stroustrup在《The Design and Evolution of C++》中提到“C++和ANSI C之间不应该存在无故的不兼容”，C++因此也背上了C的不少历史包袱。有的不兼容之处，如sizeof(&#039;a&#039;)等于几的问题，在很多文献中都说明了原因。但像register语义为什么不兼容？我暂时没有找到有文献说明明确的原因。</description>
		<content:encoded><![CDATA[<p>是的，我看过标准，文中也引用了标准中的部分文字。C和C++中register的语义是明确且不同的。</p>
<p>我是想说，二者这种差异的原因是什么？C++在这个问题上为什么不与C兼容？<br />
Stroustrup在《The Design and Evolution of C++》中提到“C++和ANSI C之间不应该存在无故的不兼容”，C++因此也背上了C的不少历史包袱。有的不兼容之处，如sizeof('a')等于几的问题，在很多文献中都说明了原因。但像register语义为什么不兼容？我暂时没有找到有文献说明明确的原因。</p>
]]></content:encoded>
	</item>
	<item>
		<title>来自：luguo</title>
		<link>http://blog.linjian.org/articles/c-cpp-register-difference/comment-page-1/#comment-132</link>
		<dc:creator>luguo</dc:creator>
		<pubDate>Thu, 30 Apr 2009 11:33:55 +0000</pubDate>
		<guid isPermaLink="false">http://blog.linjian.org/?p=330#comment-132</guid>
		<description>C99已经明确指出了啊！
The implementation may treat any register declaration simply as an auto declaration. However,
whether or not addressable storage is actually used, the address of any part of an object declared with
storage-class specifier register cannot be computed, either explicitly (by use of the unary &amp;
operator as discussed in 6.5.3.2) 

C++0x也说的够清楚了吧：
the hint
  can be ignored and in most implementations it will be ignored if the address of the object is taken.</description>
		<content:encoded><![CDATA[<p>C99已经明确指出了啊！<br />
The implementation may treat any register declaration simply as an auto declaration. However,<br />
whether or not addressable storage is actually used, the address of any part of an object declared with<br />
storage-class specifier register cannot be computed, either explicitly (by use of the unary &amp;<br />
operator as discussed in 6.5.3.2) </p>
<p>C++0x也说的够清楚了吧：<br />
the hint<br />
  can be ignored and in most implementations it will be ignored if the address of the object is taken.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
