<?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#"
	
	>
<channel>
	<title>
	Comments on: How Compact Code Can Become Buggy Code: Getting Caught By The Order of Evaluations	</title>
	<atom:link href="https://www.fluentcpp.com/2017/05/09/compact-code-becomes-buggy-code-order-evaluations/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.fluentcpp.com/2017/05/09/compact-code-becomes-buggy-code-order-evaluations/</link>
	<description>Jonathan Boccara&#039;s blog</description>
	<lastBuildDate>Mon, 02 Oct 2017 20:33:07 +0000</lastBuildDate>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.5.4</generator>
	<item>
		<title>
		By: Jeremy Demeule		</title>
		<link>https://www.fluentcpp.com/2017/05/09/compact-code-becomes-buggy-code-order-evaluations/#comment-261</link>

		<dc:creator><![CDATA[Jeremy Demeule]]></dc:creator>
		<pubDate>Wed, 10 May 2017 20:31:00 +0000</pubDate>
		<guid isPermaLink="false">https://www.fluentcpp.com/?p=1134#comment-261</guid>

					<description><![CDATA[Hello Jonathan,

I do not think the compactness of the code nor the evaluation order have something to do with the issue you are trying to expose.
When a function take a reference/pointer as parameters, it expect parameters are valid during the call and independent. This is the default/implicit contract. This is not something new,  memcpy and memmove (with the same prototype before C99) forbid, and respectively accept, overlapping parameters.

This is also what Herb Sutter explain during his CppCon 2015 keynote (Writing Good C++14… By Default [slide 50]).

I think this is the responsibility of the caller the respect the contract. Else, the behavior is undefined and this is was you see here. Something is working, sometimes not, order of evaluation is just a way to raise this issue.]]></description>
			<content:encoded><![CDATA[<p>Hello Jonathan,</p>
<p>I do not think the compactness of the code nor the evaluation order have something to do with the issue you are trying to expose.<br />
When a function take a reference/pointer as parameters, it expect parameters are valid during the call and independent. This is the default/implicit contract. This is not something new,  memcpy and memmove (with the same prototype before C99) forbid, and respectively accept, overlapping parameters.</p>
<p>This is also what Herb Sutter explain during his CppCon 2015 keynote (Writing Good C++14… By Default [slide 50]).</p>
<p>I think this is the responsibility of the caller the respect the contract. Else, the behavior is undefined and this is was you see here. Something is working, sometimes not, order of evaluation is just a way to raise this issue.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Andrey Upadyshev		</title>
		<link>https://www.fluentcpp.com/2017/05/09/compact-code-becomes-buggy-code-order-evaluations/#comment-256</link>

		<dc:creator><![CDATA[Andrey Upadyshev]]></dc:creator>
		<pubDate>Tue, 09 May 2017 13:12:00 +0000</pubDate>
		<guid isPermaLink="false">https://www.fluentcpp.com/?p=1134#comment-256</guid>

					<description><![CDATA[Thank you for a good article. I want to add that in most cases (all cases from my experience) it&#039;s better to pass unique_ptr by rvalue reference. Then your example is safe :). But it&#039;s not only about this particular case. Passing by reference allows callee to decide when to do the actual move thus for example, in case of exception callee can leave the pointer unmoved and caller still owns the object and can do some other operation with it or whatewer. That&#039;s not possible if unique_ptr is passed by value.]]></description>
			<content:encoded><![CDATA[<p>Thank you for a good article. I want to add that in most cases (all cases from my experience) it&#8217;s better to pass unique_ptr by rvalue reference. Then your example is safe :). But it&#8217;s not only about this particular case. Passing by reference allows callee to decide when to do the actual move thus for example, in case of exception callee can leave the pointer unmoved and caller still owns the object and can do some other operation with it or whatewer. That&#8217;s not possible if unique_ptr is passed by value.</p>
]]></content:encoded>
		
			</item>
	</channel>
</rss>
