<?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: Mins and Maxes with the STL	</title>
	<atom:link href="https://www.fluentcpp.com/2017/04/11/mins-maxes-stl/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.fluentcpp.com/2017/04/11/mins-maxes-stl/</link>
	<description>Jonathan Boccara&#039;s blog</description>
	<lastBuildDate>Wed, 28 Nov 2018 01:22:00 +0000</lastBuildDate>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.5.4</generator>
	<item>
		<title>
		By: dedowsdi		</title>
		<link>https://www.fluentcpp.com/2017/04/11/mins-maxes-stl/#comment-1502</link>

		<dc:creator><![CDATA[dedowsdi]]></dc:creator>
		<pubDate>Wed, 28 Nov 2018 01:22:00 +0000</pubDate>
		<guid isPermaLink="false">https://www.fluentcpp.com/?p=832#comment-1502</guid>

					<description><![CDATA[I like this article,  the note on min and max should save lots of hard time in my coding life.]]></description>
			<content:encoded><![CDATA[<p>I like this article,  the note on min and max should save lots of hard time in my coding life.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Jonathan Boccara		</title>
		<link>https://www.fluentcpp.com/2017/04/11/mins-maxes-stl/#comment-204</link>

		<dc:creator><![CDATA[Jonathan Boccara]]></dc:creator>
		<pubDate>Sat, 15 Apr 2017 23:31:00 +0000</pubDate>
		<guid isPermaLink="false">https://www.fluentcpp.com/?p=832#comment-204</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.fluentcpp.com/2017/04/11/mins-maxes-stl/#comment-202&quot;&gt;itmanhieu&lt;/a&gt;.

It has the same behaviour indeed. You can check this example: http://cpp.sh/9y3pi, where min_element and max_element return the same element, for a collection of 2 elements. But this is arguably less troubling than the bug with max, because max_element doesn&#039;t necessary accepts 2 elements, but rather a collection of N, which could be 1 or even 0. So you wouldn&#039;t rely as much as the min being different from the max when you write code, I think.]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://www.fluentcpp.com/2017/04/11/mins-maxes-stl/#comment-202">itmanhieu</a>.</p>
<p>It has the same behaviour indeed. You can check this example: <a href="http://cpp.sh/9y3pi" rel="nofollow ugc">http://cpp.sh/9y3pi</a>, where min_element and max_element return the same element, for a collection of 2 elements. But this is arguably less troubling than the bug with max, because max_element doesn&#8217;t necessary accepts 2 elements, but rather a collection of N, which could be 1 or even 0. So you wouldn&#8217;t rely as much as the min being different from the max when you write code, I think.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: itmanhieu		</title>
		<link>https://www.fluentcpp.com/2017/04/11/mins-maxes-stl/#comment-202</link>

		<dc:creator><![CDATA[itmanhieu]]></dc:creator>
		<pubDate>Thu, 13 Apr 2017 08:46:00 +0000</pubDate>
		<guid isPermaLink="false">https://www.fluentcpp.com/?p=832#comment-202</guid>

					<description><![CDATA[So Does the max_element function have the same bug as the max function?]]></description>
			<content:encoded><![CDATA[<p>So Does the max_element function have the same bug as the max function?</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Jonathan Boccara		</title>
		<link>https://www.fluentcpp.com/2017/04/11/mins-maxes-stl/#comment-201</link>

		<dc:creator><![CDATA[Jonathan Boccara]]></dc:creator>
		<pubDate>Wed, 12 Apr 2017 20:09:00 +0000</pubDate>
		<guid isPermaLink="false">https://www.fluentcpp.com/?p=832#comment-201</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.fluentcpp.com/2017/04/11/mins-maxes-stl/#comment-198&quot;&gt;Alexander Gallego&lt;/a&gt;.

Thanks for noticing Alexander, I&#039;ve corrected this. And glad that you enjoyed the reading!]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://www.fluentcpp.com/2017/04/11/mins-maxes-stl/#comment-198">Alexander Gallego</a>.</p>
<p>Thanks for noticing Alexander, I&#8217;ve corrected this. And glad that you enjoyed the reading!</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Dima Matrohin		</title>
		<link>https://www.fluentcpp.com/2017/04/11/mins-maxes-stl/#comment-200</link>

		<dc:creator><![CDATA[Dima Matrohin]]></dc:creator>
		<pubDate>Wed, 12 Apr 2017 13:10:00 +0000</pubDate>
		<guid isPermaLink="false">https://www.fluentcpp.com/?p=832#comment-200</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.fluentcpp.com/2017/04/11/mins-maxes-stl/#comment-199&quot;&gt;AndriusV&lt;/a&gt;.

As far as I understand, yes, it is compiler specific.
Also it depends on level of optimization, my testing:
GCC 6.3.1 with &quot;-O0&quot; option prints &quot;2&quot;
GCC 6.3.1 with &quot;-O2&quot; option prints &quot;0&quot;
but clang 3.9.1 prints &quot;2&quot; in both cases.

This is what undefined behaviour about.
In gcc.godbolt.org you can see, that such code for GCC and clang works correctly with -O0, because he creates temporary values on stack for return values of get2 and get3, but compiler is not required to do that.]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://www.fluentcpp.com/2017/04/11/mins-maxes-stl/#comment-199">AndriusV</a>.</p>
<p>As far as I understand, yes, it is compiler specific.<br />
Also it depends on level of optimization, my testing:<br />
GCC 6.3.1 with &#8220;-O0&#8221; option prints &#8220;2&#8221;<br />
GCC 6.3.1 with &#8220;-O2&#8221; option prints &#8220;0&#8221;<br />
but clang 3.9.1 prints &#8220;2&#8221; in both cases.</p>
<p>This is what undefined behaviour about.<br />
In gcc.godbolt.org you can see, that such code for GCC and clang works correctly with -O0, because he creates temporary values on stack for return values of get2 and get3, but compiler is not required to do that.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: AndriusV		</title>
		<link>https://www.fluentcpp.com/2017/04/11/mins-maxes-stl/#comment-199</link>

		<dc:creator><![CDATA[AndriusV]]></dc:creator>
		<pubDate>Wed, 12 Apr 2017 06:30:00 +0000</pubDate>
		<guid isPermaLink="false">https://www.fluentcpp.com/?p=832#comment-199</guid>

					<description><![CDATA[&quot;We may expect this code to display 2. But in fact it goes into undefined behaviour.&quot;
I tried the code in cpp.sh and it actually displays 2. Is it compiler specific or depends on some context?]]></description>
			<content:encoded><![CDATA[<p>&#8220;We may expect this code to display 2. But in fact it goes into undefined behaviour.&#8221;<br />
I tried the code in cpp.sh and it actually displays 2. Is it compiler specific or depends on some context?</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Alexander Gallego		</title>
		<link>https://www.fluentcpp.com/2017/04/11/mins-maxes-stl/#comment-198</link>

		<dc:creator><![CDATA[Alexander Gallego]]></dc:creator>
		<pubDate>Tue, 11 Apr 2017 14:08:00 +0000</pubDate>
		<guid isPermaLink="false">https://www.fluentcpp.com/?p=832#comment-198</guid>

					<description><![CDATA[Hi Jon the post has a bunch of literal &#039;&lt;/code&gt;&#039; tags sprinkled in. Thanks for the post. Fun to read as usual!]]></description>
			<content:encoded><![CDATA[<p>Hi Jon the post has a bunch of literal &#8216;&#8216; tags sprinkled in. Thanks for the post. Fun to read as usual!</p>
]]></content:encoded>
		
			</item>
	</channel>
</rss>
