<?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: Word Counting in C++: Computing the Span of a Word	</title>
	<atom:link href="https://www.fluentcpp.com/2018/10/23/word-counting-span/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.fluentcpp.com/2018/10/23/word-counting-span/</link>
	<description>Jonathan Boccara&#039;s blog</description>
	<lastBuildDate>Thu, 08 Nov 2018 12:08: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: Jonathan Boccara		</title>
		<link>https://www.fluentcpp.com/2018/10/23/word-counting-span/#comment-1445</link>

		<dc:creator><![CDATA[Jonathan Boccara]]></dc:creator>
		<pubDate>Thu, 08 Nov 2018 12:08:00 +0000</pubDate>
		<guid isPermaLink="false">https://www.fluentcpp.com/?p=4318#comment-1445</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.fluentcpp.com/2018/10/23/word-counting-span/#comment-1432&quot;&gt;kl_pq&lt;/a&gt;.

Yes, good idea thanks!]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://www.fluentcpp.com/2018/10/23/word-counting-span/#comment-1432">kl_pq</a>.</p>
<p>Yes, good idea thanks!</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: kl_pq		</title>
		<link>https://www.fluentcpp.com/2018/10/23/word-counting-span/#comment-1432</link>

		<dc:creator><![CDATA[kl_pq]]></dc:creator>
		<pubDate>Fri, 02 Nov 2018 08:17:00 +0000</pubDate>
		<guid isPermaLink="false">https://www.fluentcpp.com/?p=4318#comment-1432</guid>

					<description><![CDATA[I guess I&#039;m a bit late but I&#039;d like to mention that I believe you neither need nor should use optional here: The WordStats instance gets created only when there is a word, and therefore there also must be an initial line number.
So if a WordStats object got created but no occurrence was ever added added, this is probably a logic error and would even justify assert()ing.

In my opinion the code gets simpler by just checking the value of nbOccurrences_: http://coliru.stacked-crooked.com/a/9c6953aa32ef4973]]></description>
			<content:encoded><![CDATA[<p>I guess I&#8217;m a bit late but I&#8217;d like to mention that I believe you neither need nor should use optional here: The WordStats instance gets created only when there is a word, and therefore there also must be an initial line number.<br />
So if a WordStats object got created but no occurrence was ever added added, this is probably a logic error and would even justify assert()ing.</p>
<p>In my opinion the code gets simpler by just checking the value of nbOccurrences_: <a href="http://coliru.stacked-crooked.com/a/9c6953aa32ef4973" rel="nofollow ugc">http://coliru.stacked-crooked.com/a/9c6953aa32ef4973</a></p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Jonathan Boccara		</title>
		<link>https://www.fluentcpp.com/2018/10/23/word-counting-span/#comment-1408</link>

		<dc:creator><![CDATA[Jonathan Boccara]]></dc:creator>
		<pubDate>Tue, 23 Oct 2018 21:12:00 +0000</pubDate>
		<guid isPermaLink="false">https://www.fluentcpp.com/?p=4318#comment-1408</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.fluentcpp.com/2018/10/23/word-counting-span/#comment-1402&quot;&gt;Benjamin Navarro&lt;/a&gt;.

Yes good point! I will implement this, thanks for the suggestion.]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://www.fluentcpp.com/2018/10/23/word-counting-span/#comment-1402">Benjamin Navarro</a>.</p>
<p>Yes good point! I will implement this, thanks for the suggestion.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Jonathan Boccara		</title>
		<link>https://www.fluentcpp.com/2018/10/23/word-counting-span/#comment-1407</link>

		<dc:creator><![CDATA[Jonathan Boccara]]></dc:creator>
		<pubDate>Tue, 23 Oct 2018 21:09:00 +0000</pubDate>
		<guid isPermaLink="false">https://www.fluentcpp.com/?p=4318#comment-1407</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.fluentcpp.com/2018/10/23/word-counting-span/#comment-1401&quot;&gt;jft&lt;/a&gt;.

Thanks for your comment. My idea of span is also to see how spread out a concept (independent of C++ concepts) is in code. So even if a term is somehow carried by several object, and all are huddled together, I&#039;d like to know this. What&#039;s your opinion on that?
About your latest remark, I see your point, so how about expanding span to a measure of density perhaps, equal to #occurrences/span for example?]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://www.fluentcpp.com/2018/10/23/word-counting-span/#comment-1401">jft</a>.</p>
<p>Thanks for your comment. My idea of span is also to see how spread out a concept (independent of C++ concepts) is in code. So even if a term is somehow carried by several object, and all are huddled together, I&#8217;d like to know this. What&#8217;s your opinion on that?<br />
About your latest remark, I see your point, so how about expanding span to a measure of density perhaps, equal to #occurrences/span for example?</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Benjamin Navarro		</title>
		<link>https://www.fluentcpp.com/2018/10/23/word-counting-span/#comment-1402</link>

		<dc:creator><![CDATA[Benjamin Navarro]]></dc:creator>
		<pubDate>Tue, 23 Oct 2018 16:44:00 +0000</pubDate>
		<guid isPermaLink="false">https://www.fluentcpp.com/?p=4318#comment-1402</guid>

					<description><![CDATA[I usually rely on ±std::numeric_limits::max() to initialize my min/max variables. This way, no checks are required since for the first run, std::min(std::numeric_limits::max(), value) or std::max(-std::numeric_limits::max(), value) will both return value. I edited the code to reflect this: http://coliru.stacked-crooked.com/a/5a951e60df4d7a08]]></description>
			<content:encoded><![CDATA[<p>I usually rely on ±std::numeric_limits::max() to initialize my min/max variables. This way, no checks are required since for the first run, std::min(std::numeric_limits::max(), value) or std::max(-std::numeric_limits::max(), value) will both return value. I edited the code to reflect this: <a href="http://coliru.stacked-crooked.com/a/5a951e60df4d7a08" rel="nofollow ugc">http://coliru.stacked-crooked.com/a/5a951e60df4d7a08</a></p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: jft		</title>
		<link>https://www.fluentcpp.com/2018/10/23/word-counting-span/#comment-1401</link>

		<dc:creator><![CDATA[jft]]></dc:creator>
		<pubDate>Tue, 23 Oct 2018 10:20:00 +0000</pubDate>
		<guid isPermaLink="false">https://www.fluentcpp.com/?p=4318#comment-1401</guid>

					<description><![CDATA[&quot; it indicates how spread out the word is in a piece of code: are all its usage located in the same area?&quot;


Yes if the usage of the word is at the same scope. But say:


&lt;pre&gt;&lt;code&gt;
for (int i = 0; i &#060; 5; ++i)
   cout &#060;&#060; i &#060;&#060; &#034; &#034;;
for (int i = 10; i &#060; 15; ++i)
    cout &#060;&#060; i + 10 &#060;&#060; &#034; &#034;;
&lt;/code&gt;&lt;/pre&gt;


The 2 i integer variables here are not the same variable. So saying that i here has a span of 4 IMO is not correct. There are essentially 2 different i variables here each with a span of 2. And if multiple structs/classes are used which have the same name for a member variable/function then I&#039;m not sure what a span number is implying? - especially if a class declaration is separate from its definitions and its usage. What about function declarations and definitions? The span of a variable in a function declaration at the top of a program would be from its declaration line to its last line of usage - which could be hundreds and hundreds of lines between its usage in a function declaration and its first usage in the actual function. 



???]]></description>
			<content:encoded><![CDATA[<p>&#8221; it indicates how spread out the word is in a piece of code: are all its usage located in the same area?&#8221;</p>
<p>Yes if the usage of the word is at the same scope. But say:</p>
<pre><code>
for (int i = 0; i &lt; 5; ++i)
   cout &lt;&lt; i &lt;&lt; &quot; &quot;;
for (int i = 10; i &lt; 15; ++i)
    cout &lt;&lt; i + 10 &lt;&lt; &quot; &quot;;
</code></pre>
<p>The 2 i integer variables here are not the same variable. So saying that i here has a span of 4 IMO is not correct. There are essentially 2 different i variables here each with a span of 2. And if multiple structs/classes are used which have the same name for a member variable/function then I&#8217;m not sure what a span number is implying? &#8211; especially if a class declaration is separate from its definitions and its usage. What about function declarations and definitions? The span of a variable in a function declaration at the top of a program would be from its declaration line to its last line of usage &#8211; which could be hundreds and hundreds of lines between its usage in a function declaration and its first usage in the actual function. </p>
<p>???</p>
]]></content:encoded>
		
			</item>
	</channel>
</rss>
