<?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: C99 Language Lawyer Needed</title>
	<atom:link href="http://blog.regehr.org/archives/681/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.regehr.org/archives/681</link>
	<description></description>
	<lastBuildDate>Sat, 18 May 2013 15:30:07 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
	<item>
		<title>By: Derek Jones</title>
		<link>http://blog.regehr.org/archives/681/comment-page-1#comment-3964</link>
		<dc:creator>Derek Jones</dc:creator>
		<pubDate>Wed, 08 Feb 2012 17:18:29 +0000</pubDate>
		<guid isPermaLink="false">http://blog.regehr.org/?p=681#comment-3964</guid>
		<description><![CDATA[Jeroen,  I am guilty of answering a modified form of the original question (which I think is defined because all the relevant wordings talk about objects and not their storage).

My explanation applies to the case of the following statement appearing in the above code:

s.f0 = s.f1;]]></description>
		<content:encoded><![CDATA[<p>Jeroen,  I am guilty of answering a modified form of the original question (which I think is defined because all the relevant wordings talk about objects and not their storage).</p>
<p>My explanation applies to the case of the following statement appearing in the above code:</p>
<p>s.f0 = s.f1;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jeroen Mostert</title>
		<link>http://blog.regehr.org/archives/681/comment-page-1#comment-3963</link>
		<dc:creator>Jeroen Mostert</dc:creator>
		<pubDate>Wed, 08 Feb 2012 16:01:07 +0000</pubDate>
		<guid isPermaLink="false">http://blog.regehr.org/?p=681#comment-3963</guid>
		<description><![CDATA[Thinking a bit more, the only way you could use 6.5.16.1p3 to make adjacent bit-field assignments illegal is if you used the following interpretation:
- Adjacent bit-fields overlap each other in storage since they&#039;re in the same storage unit; but
- This overlap is not exact because their *storage* within that unit is not the same.
This seems deliberately contrived, measuring with two yardsticks. Either contend that the overlap is exact because it&#039;s the same storage unit, or there&#039;s no overlap at all because the region of data storage is distinct. Either way would avoid it.

I prefer the latter interpretation because the first still poses a problem: if the bit-fields are not of the same type, assignment is still undefined because, even though the overlap is exact, the types are not compatible (the other requirement of 6.5.16.1p3). Give the poor bit-fields a break. :-)]]></description>
		<content:encoded><![CDATA[<p>Thinking a bit more, the only way you could use 6.5.16.1p3 to make adjacent bit-field assignments illegal is if you used the following interpretation:<br />
- Adjacent bit-fields overlap each other in storage since they&#8217;re in the same storage unit; but<br />
- This overlap is not exact because their *storage* within that unit is not the same.<br />
This seems deliberately contrived, measuring with two yardsticks. Either contend that the overlap is exact because it&#8217;s the same storage unit, or there&#8217;s no overlap at all because the region of data storage is distinct. Either way would avoid it.</p>
<p>I prefer the latter interpretation because the first still poses a problem: if the bit-fields are not of the same type, assignment is still undefined because, even though the overlap is exact, the types are not compatible (the other requirement of 6.5.16.1p3). Give the poor bit-fields a break. <img src='http://blog.regehr.org/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jeroen Mostert</title>
		<link>http://blog.regehr.org/archives/681/comment-page-1#comment-3962</link>
		<dc:creator>Jeroen Mostert</dc:creator>
		<pubDate>Wed, 08 Feb 2012 15:52:34 +0000</pubDate>
		<guid isPermaLink="false">http://blog.regehr.org/?p=681#comment-3962</guid>
		<description><![CDATA[6.5.16.1p3 cannot possibly apply here because &quot;the value being stored&quot; is in both cases a suitably-converted 0, and not &quot;read from another object&quot;. Regardless of storage, the bit-fields are clearly distinct objects. This section describes the semantics of assignment, not general object access.

If we read the value from the other bit-field, but then the expression invokes UB by simple sequence point violation. If we read the value from a bit-field not involved in this expression, then the discussion about storage would apply. I think that, since bit-fields are distinct objects and hence distinct &quot;regions of data storage&quot; (the standard&#039;s definition of an object) even if they also occupy the same storage unit, 6.5.16.1p3 would not invoke UB for bit-field assignments. To interpret this section otherwise would make all assignments from a bit-field to an adjacent bit-field illegal, which I&#039;m pretty sure is not what the standard is going for.]]></description>
		<content:encoded><![CDATA[<p>6.5.16.1p3 cannot possibly apply here because &#8220;the value being stored&#8221; is in both cases a suitably-converted 0, and not &#8220;read from another object&#8221;. Regardless of storage, the bit-fields are clearly distinct objects. This section describes the semantics of assignment, not general object access.</p>
<p>If we read the value from the other bit-field, but then the expression invokes UB by simple sequence point violation. If we read the value from a bit-field not involved in this expression, then the discussion about storage would apply. I think that, since bit-fields are distinct objects and hence distinct &#8220;regions of data storage&#8221; (the standard&#8217;s definition of an object) even if they also occupy the same storage unit, 6.5.16.1p3 would not invoke UB for bit-field assignments. To interpret this section otherwise would make all assignments from a bit-field to an adjacent bit-field illegal, which I&#8217;m pretty sure is not what the standard is going for.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Derek Jones</title>
		<link>http://blog.regehr.org/archives/681/comment-page-1#comment-3961</link>
		<dc:creator>Derek Jones</dc:creator>
		<pubDate>Wed, 08 Feb 2012 15:21:05 +0000</pubDate>
		<guid isPermaLink="false">http://blog.regehr.org/?p=681#comment-3961</guid>
		<description><![CDATA[John,  this is an interesting question.

The issue here is two or more objects (e.g., bit-fields) potentially sharing the same &quot;storage unit&quot;

Sentence 1409/1410: 
http://c0x.coding-guidelines.com/6.7.2.1.html

coupled with the the meaning of  &quot;overlaps in any way&quot; in:

C11/C99 6.5.16.1p3 
Sentence 1304:  http://c0x.coding-guidelines.com/6.5.16.1.html

&quot;If the value being stored in an object is read from another object that overlaps in any way
the storage of the first object, then the overlap shall be exact ...&quot;

Does overlap refer to storage units, just the bits allocated to the bit-field object (making the behavior well defined) or something else?

If it refers to a storage unit then the overlap would appear to be exact, making the behavior well defined.

I will ask WG14 people what they think.]]></description>
		<content:encoded><![CDATA[<p>John,  this is an interesting question.</p>
<p>The issue here is two or more objects (e.g., bit-fields) potentially sharing the same &#8220;storage unit&#8221;</p>
<p>Sentence 1409/1410:<br />
<a href="http://c0x.coding-guidelines.com/6.7.2.1.html" rel="nofollow">http://c0x.coding-guidelines.com/6.7.2.1.html</a></p>
<p>coupled with the the meaning of  &#8220;overlaps in any way&#8221; in:</p>
<p>C11/C99 6.5.16.1p3<br />
Sentence 1304:  <a href="http://c0x.coding-guidelines.com/6.5.16.1.html" rel="nofollow">http://c0x.coding-guidelines.com/6.5.16.1.html</a></p>
<p>&#8220;If the value being stored in an object is read from another object that overlaps in any way<br />
the storage of the first object, then the overlap shall be exact &#8230;&#8221;</p>
<p>Does overlap refer to storage units, just the bits allocated to the bit-field object (making the behavior well defined) or something else?</p>
<p>If it refers to a storage unit then the overlap would appear to be exact, making the behavior well defined.</p>
<p>I will ask WG14 people what they think.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jeroen Mostert</title>
		<link>http://blog.regehr.org/archives/681/comment-page-1#comment-3956</link>
		<dc:creator>Jeroen Mostert</dc:creator>
		<pubDate>Wed, 08 Feb 2012 06:39:01 +0000</pubDate>
		<guid isPermaLink="false">http://blog.regehr.org/?p=681#comment-3956</guid>
		<description><![CDATA[I&#039;m sorry. &quot;I think I mentioned the pipeline once, but I got away with it.&quot;  :-) For purposes of standards wrangling, though, it&#039;s always permissible to drag in a real-world concept if it can be shown to be consistent with the standard. As an extreme example, a C11 implementation could forcibly parallelize calculations that can be parallelized according to the standard. Probably no real-world C implementation would do this, but if it&#039;s conceivable under the standard, and it causes UB, then there&#039;s the possibility of UB, and that was what the question&#039;s about.

And yes, comp.std.c is not like comp.lang.c at all. If comp.lang.c is a battlefield, comp.std.c is a fencing academy. The fact that it sees vastly less traffic helps, of course.]]></description>
		<content:encoded><![CDATA[<p>I&#8217;m sorry. &#8220;I think I mentioned the pipeline once, but I got away with it.&#8221;  <img src='http://blog.regehr.org/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  For purposes of standards wrangling, though, it&#8217;s always permissible to drag in a real-world concept if it can be shown to be consistent with the standard. As an extreme example, a C11 implementation could forcibly parallelize calculations that can be parallelized according to the standard. Probably no real-world C implementation would do this, but if it&#8217;s conceivable under the standard, and it causes UB, then there&#8217;s the possibility of UB, and that was what the question&#8217;s about.</p>
<p>And yes, comp.std.c is not like comp.lang.c at all. If comp.lang.c is a battlefield, comp.std.c is a fencing academy. The fact that it sees vastly less traffic helps, of course.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
