[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kwrite-devel
Subject:    Re: Review Request 113859: Single characters made QChar instead of QString
From:       "Matthew Woehlke" <mw_triad () users ! sourceforge ! net>
Date:       2013-11-14 16:39:58
Message-ID: 20131114163958.14076.60218 () vidsolbach ! de
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


> On Nov. 14, 2013, 10:48 a.m., Dominik Haumann wrote:
> > addons/kate/close-except-like/close_except_plugin.cpp, line 300
> > <http://git.reviewboard.kde.org/r/113859/diff/2/?file=214095#file214095line300>
> > 
> > This is not correct, it should be:
> > const QString ext = ...
> > 
> > Without the &.

Why? Retaining the result by reference explicitly avoids a copy: \
http://herbsutter.com/2008/01/01/gotw-88-a-candidate-for-the-most-important-const/.


- Matthew


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/113859/#review43675
-----------------------------------------------------------


On Nov. 14, 2013, 10:32 a.m., Harsh Kumar wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://git.reviewboard.kde.org/r/113859/
> -----------------------------------------------------------
> 
> (Updated Nov. 14, 2013, 10:32 a.m.)
> 
> 
> Review request for Kate.
> 
> 
> Repository: kate
> 
> 
> Description
> -------
> 
> Making single characters as QChar when they are added to a QString. 
> Adding single characters to a QString is faster if the characters are QChars and \
> not QStrings. 
> Same holds for arguments to QString::startsWith(), QString::endsWith(), \
> QString::remove() and QString::section() Changes made to in these function calls as \
> well 
> 
> Diffs
> -----
> 
> part/vimode/kateviglobal.cpp 4f06796 
> part/vimode/kateviinsertmode.cpp a520785 
> part/vimode/katevinormalmode.cpp e8af968 
> tests/script_test_base.cpp 18b3aa9 
> tests/vimode_test.cpp ed94c0c 
> addons/kate/close-except-like/close_except_plugin.cpp 1cc5b59 
> addons/kate/gdbplugin/debugview.cpp 7afe0ec 
> addons/kate/kate-ctags/kate_ctags_plugin.cpp f145c44 
> addons/kate/kate-ctags/kate_ctags_view.cpp 7d66461 
> addons/kate/katesql/schemawidget.cpp 68a8ffe 
> addons/kate/project/kateprojectworker.cpp e23ae6e 
> addons/kate/search/plugin_search.cpp cd1ed08 
> addons/kate/symbolviewer/php_parser.cpp 36e8ded 
> addons/kate/textfilter/plugin_katetextfilter.cpp 5a00fce 
> addons/kate/xmltools/plugin_katexmltools.cpp 793e707 
> ktexteditor/templateinterface.cpp 51f1e38 
> 
> Diff: http://git.reviewboard.kde.org/r/113859/diff/
> 
> 
> Testing
> -------
> 
> Compiles & runs
> 
> 
> Thanks,
> 
> Harsh Kumar
> 
> 


[Attachment #5 (text/html)]

<html>
 <body>
  <div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
   <table bgcolor="#f9f3c9" width="100%" cellpadding="8" style="border: 1px #c9c399 \
solid;">  <tr>
     <td>
      This is an automatically generated e-mail. To reply, visit:
      <a href="http://git.reviewboard.kde.org/r/113859/">http://git.reviewboard.kde.org/r/113859/</a>
  </td>
    </tr>
   </table>
   <br />










<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: \
10px;">  <p style="margin-top: 0;">On November 14th, 2013, 10:48 a.m. EST, <b>Dominik \
Haumann</b> wrote:</p>  <blockquote style="margin-left: 1em; border-left: 2px solid \
#d0d0d0; padding-left: 10px;">  



<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; \
border-collapse: collapse; margin: 2px padding: 2px;">  <thead>
  <tr>
   <th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; \
font-size: 9pt; padding: 4px 8px; text-align: left;">  <a \
href="http://git.reviewboard.kde.org/r/113859/diff/2/?file=214095#file214095line300" \
style="color: black; font-weight: bold; text-decoration: \
underline;">addons/kate/close-except-like/close_except_plugin.cpp</a>  <span \
style="font-weight: normal;">

     (Diff revision 2)

    </span>
   </th>
  </tr>
 </thead>

 <tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
  <tr>

   <td colspan="4"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">void \
CloseExceptPluginView::close(const QString&amp; item, const bool \
close_if_match)</pre></td>

  </tr>
 </tbody>



 
 

 <tbody>

  <tr>
    <th bgcolor="#e9eaa8" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2">300</font></th>  <td bgcolor="#fdfebc" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; ">        <span \
class="k">const</span> <span class="n">QString</span><span class="o">&amp;</span> \
<span class="n">ext</span> <span class="o">=</span> <span class="s"><span \
class="hl">&quot;.&quot;</span></span> <span class="o">+</span> <span \
class="n">QFileInfo</span><span class="p">(</span><span \
class="n">document</span><span class="o">-&gt;</span><span class="n">url</span><span \
class="p">().</span><span class="n">fileName</span><span class="p">()).</span><span \
class="n">completeSuffix</span><span class="p">();</span></pre></td>  <th \
bgcolor="#e9eaa8" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">300</font></th>  <td bgcolor="#fdfebc" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">        <span \
class="k">const</span> <span class="n">QString</span><span class="o">&amp;</span> \
<span class="n">ext</span> <span class="o">=</span> <span class="sc"><span \
class="hl">&#39;.&#39;</span></span> <span class="o">+</span> <span \
class="n">QFileInfo</span><span class="p">(</span><span \
class="n">document</span><span class="o">-&gt;</span><span class="n">url</span><span \
class="p">().</span><span class="n">fileName</span><span class="p">()).</span><span \
class="n">completeSuffix</span><span class="p">();</span></pre></td>  </tr>

 </tbody>

</table>

  <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">This is not correct, it \
should be:  const QString ext = ...

Without the &amp;.</pre>
 </blockquote>





</blockquote>
<pre style="margin-left: 1em; white-space: pre-wrap; white-space: -moz-pre-wrap; \
white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Why? \
Retaining the result by reference explicitly avoids a copy: \
http://herbsutter.com/2008/01/01/gotw-88-a-candidate-for-the-most-important-const/.</pre>
 <br />




<p>- Matthew</p>


<br />
<p>On November 14th, 2013, 10:32 a.m. EST, Harsh Kumar wrote:</p>








<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" \
style="background-image: \
url('http://git.reviewboard.kde.org/static/rb/images/review_request_box_top_bg.ab6f3b1072c9.png'); \
background-position: left top; background-repeat: repeat-x; border: 1px black \
solid;">  <tr>
  <td>

<div>Review request for Kate.</div>
<div>By Harsh Kumar.</div>


<p style="color: grey;"><i>Updated Nov. 14, 2013, 10:32 a.m.</i></p>









<div style="margin-top: 1.5em;">
 <b style="color: #575012; font-size: 10pt;">Repository: </b>
kate
</div>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
 <table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" \
style="border: 1px solid #b8b5a0">  <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: \
-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;">Making single characters as QChar when they are added to a QString.  \
Adding single characters to a QString is faster if the characters are QChars and not \
QStrings.

Same holds for arguments to QString::startsWith(), QString::endsWith(), \
QString::remove() and QString::section() Changes made to in these function calls as \
well</pre>  </td>
 </tr>
</table>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Testing </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: \
1px solid #b8b5a0">  <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: \
-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;">Compiles &amp; runs</pre>  </td>
 </tr>
</table>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">

 <li>part/vimode/kateviglobal.cpp <span style="color: grey">(4f06796)</span></li>

 <li>part/vimode/kateviinsertmode.cpp <span style="color: grey">(a520785)</span></li>

 <li>part/vimode/katevinormalmode.cpp <span style="color: grey">(e8af968)</span></li>

 <li>tests/script_test_base.cpp <span style="color: grey">(18b3aa9)</span></li>

 <li>tests/vimode_test.cpp <span style="color: grey">(ed94c0c)</span></li>

 <li>addons/kate/close-except-like/close_except_plugin.cpp <span style="color: \
grey">(1cc5b59)</span></li>

 <li>addons/kate/gdbplugin/debugview.cpp <span style="color: \
grey">(7afe0ec)</span></li>

 <li>addons/kate/kate-ctags/kate_ctags_plugin.cpp <span style="color: \
grey">(f145c44)</span></li>

 <li>addons/kate/kate-ctags/kate_ctags_view.cpp <span style="color: \
grey">(7d66461)</span></li>

 <li>addons/kate/katesql/schemawidget.cpp <span style="color: \
grey">(68a8ffe)</span></li>

 <li>addons/kate/project/kateprojectworker.cpp <span style="color: \
grey">(e23ae6e)</span></li>

 <li>addons/kate/search/plugin_search.cpp <span style="color: \
grey">(cd1ed08)</span></li>

 <li>addons/kate/symbolviewer/php_parser.cpp <span style="color: \
grey">(36e8ded)</span></li>

 <li>addons/kate/textfilter/plugin_katetextfilter.cpp <span style="color: \
grey">(5a00fce)</span></li>

 <li>addons/kate/xmltools/plugin_katexmltools.cpp <span style="color: \
grey">(793e707)</span></li>

 <li>ktexteditor/templateinterface.cpp <span style="color: \
grey">(51f1e38)</span></li>

</ul>

<p><a href="http://git.reviewboard.kde.org/r/113859/diff/" style="margin-left: \
3em;">View Diff</a></p>







  </td>
 </tr>
</table>








  </div>
 </body>
</html>



_______________________________________________
KWrite-Devel mailing list
KWrite-Devel@kde.org
https://mail.kde.org/mailman/listinfo/kwrite-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic