<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Recent changes to 21: compiler warning: std::streamoff is not size_t</title><link>https://sourceforge.net/p/rapidxml/bugs/21/</link><description>Recent changes to 21: compiler warning: std::streamoff is not size_t</description><atom:link href="https://sourceforge.net/p/rapidxml/bugs/21/feed.rss" rel="self"/><language>en</language><lastBuildDate>Wed, 02 Jul 2014 09:23:51 -0000</lastBuildDate><atom:link href="https://sourceforge.net/p/rapidxml/bugs/21/feed.rss" rel="self" type="application/rss+xml"/><item><title>#21 compiler warning: std::streamoff is not size_t</title><link>https://sourceforge.net/p/rapidxml/bugs/21/?limit=50#c6c5</link><description>&lt;div class="markdown_content"&gt;&lt;p&gt;Casting away the warning is not enough here, because proper error handling for tellg() returning -1 is still missing.&lt;/p&gt;&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Weber</dc:creator><pubDate>Wed, 02 Jul 2014 09:23:51 -0000</pubDate><guid>https://sourceforge.netbdf1496b6a0f8ad62aeb06261003080e3ac46fea</guid></item><item><title>compiler warning: std::streamoff is not size_t</title><link>https://sourceforge.net/p/rapidxml/bugs/21/</link><description>&lt;div class="markdown_content"&gt;&lt;p&gt;On Windows 7 with Visual Studio 2012 the following code:&lt;/p&gt;
&lt;p&gt;void openFile(const std::string&amp;amp; path){&lt;br /&gt;
  rapidxml::xml_document&amp;lt;&amp;gt; doc;&lt;br /&gt;
  rapidxml::file&amp;lt;&amp;gt; xmlFile(path.c_str());&lt;br /&gt;
  doc.parse&amp;lt;0&amp;gt;(xmlFile.data());&lt;br /&gt;
}&lt;/p&gt;
&lt;p&gt;will result in the compiler warning:&lt;/p&gt;
&lt;p&gt;rapidxml_utils.hpp(40): warning C4244: 'initializing' : conversion from 'std::streamoff' to 'size_t', possible loss of data&lt;br /&gt;
1&amp;gt;          rapidxml_utils.hpp(28) : while compiling class template member function 'rapidxml::file&amp;lt;&amp;gt;::file(const char &lt;em&gt;)'&lt;br /&gt;
1&amp;gt;          header.h(33) : see reference to function template instantiation 'rapidxml::file&amp;lt;&amp;gt;::file(const char &lt;/em&gt;)' being compiled&lt;br /&gt;
1&amp;gt;          header.h(33) : see reference to class template instantiation 'rapidxml::file&amp;lt;&amp;gt;' being compiled&lt;/p&gt;
&lt;p&gt;Because size_t is used in the class rapidxml::file, but tellg() returns a std::streampos / std::fpos. Explicit casting to size_t solves the problem for me.&lt;/p&gt;&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Constantin</dc:creator><pubDate>Wed, 07 May 2014 13:42:41 -0000</pubDate><guid>https://sourceforge.net6e0e3e74e03e095b08deae954ded2ac7291505b5</guid></item></channel></rss>