Boost C++ Libraries: Ticket #3894: Trivial patch to fix compilation with Sun CC in alt stringstream https://svn.boost.org/trac10/ticket/3894 <p> The following trivial patch fixes compilation of <code>boost/format/alt_sstream_impl.hpp</code> with Sun CC: </p> <div class="wiki-code"> <div class="diff"> <ul class="entries"> <li class="entry"> <h2> <a>boost/format/alt_sstream_impl.hpp</a> </h2> <table class="trac-diff inline" cellspacing="0"> <colgroup> <col class="lineno"/><col class="lineno"/><col class="content"/> </colgroup> <thead> <tr> <th title="File a/boost/format/alt_sstream_impl.hpp 2007-11-20 12:40:28.000000000 +0100"> a </th> <th title="File b/boost/format/alt_sstream_impl.hpp 2010-02-02 22:16:16.000000000 +0100"> b </th> <td> <em></em> &nbsp; </td> </tr> </thead> <tbody class="unmod"> <tr> <th>249</th><th>249</th><td class="l"><span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; add_size /= 2;</span></td> </tr> <tr> <th>250</th><th>250</th><td class="l"><span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(0 &lt; add_size) {</span></td> </tr> <tr> <th>251</th><th>251</th><td class="l"><span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; new_size += add_size;</span></td> </tr> </tbody> <tbody class="mod"> <tr class="first"> <th>252</th><th>&nbsp;</th><td class="l"><span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; newptr = <del>alloc_.allocate(new_size, is_allocated_? oldptr : 0</del>);</span></td> </tr> <tr class="last"> <th>&nbsp;</th><th>252</th><td class="r"><span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; newptr = <ins>static_cast&lt;Ch *&gt;(alloc_.allocate(new_size, is_allocated_? oldptr : 0)</ins>);</span></td> </tr> </tbody> <tbody class="unmod"> <tr> <th>253</th><th>253</th><td class="l"><span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</span></td> </tr> <tr> <th>254</th><th>254</th><td class="l"><span></span></td> </tr> <tr> <th>255</th><th>255</th><td class="l"><span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(0 &lt; prev_size)</span></td> </tr> </tbody> </table> </li> </ul> </div></div><p> I don't know why (as I don't know this code at all...) but <code>allocate()</code> returns <code>void *</code> and not <code>char *</code> in this STL implementation so it fails to compile without an explicit cast. </p> <p> Maybe there is a better way to deal with this but I hope that if no other solution is found, this patch could be applied to allow to use Boost with Sun CC with its (old and broken...) standard library. </p> <p> TIA! </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/3894 Trac 1.4.3 Steven Watanabe Sat, 27 Mar 2010 05:25:04 GMT <link>https://svn.boost.org/trac10/ticket/3894#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3894#comment:1</guid> <description> <p> Boost only supports the stlport standard library with Sun CC. The default standard library is quite broken in many other ways as well. </p> </description> <category>Ticket</category> </item> <item> <author>Vadim Zeitlin <vz-boost@…></author> <pubDate>Sat, 27 Mar 2010 09:15:21 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/3894#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3894#comment:2</guid> <description> <p> Well, yes, it's broken but if you can't avoid using it (because customers code links with it and not STLport (which, BTW, is broken in its own, different, ways)) this trivial change still allows you to compile the code and our code that uses this header does work (well, as far as unit tests show, anyhow). So while, as mentioned in <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/3893" title="#3893: Patches: Fix compilation with Sun CC (without stlport) (closed: fixed)">#3893</a>, I don't plan to work around all bugs in Sun<code>^H^H^H</code>Oracle STL it would still be nice if some simple ones to work around could be fixed. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Steven Watanabe</dc:creator> <pubDate>Fri, 11 Jun 2010 23:19:42 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/3894#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3894#comment:3</guid> <description> <p> Fixed in <a class="changeset" href="https://svn.boost.org/trac10/changeset/62825" title="Make Boost.Format work with the default libCstd on sun CC. Fixes #3894">[62825]</a>. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Marshall Clow</dc:creator> <pubDate>Sat, 27 Nov 2010 18:21:56 GMT</pubDate> <title>status, milestone changed; resolution set https://svn.boost.org/trac10/ticket/3894#comment:4 https://svn.boost.org/trac10/ticket/3894#comment:4 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> <li><strong>milestone</strong> <span class="trac-field-old">Boost 1.43.0</span> → <span class="trac-field-new">Boost 1.44.0</span> </li> </ul> <p> This fix was included in 1.44.0. </p> <p> Closing. </p> Ticket