Difference between revisions of "Talk:Writing warning-free code"

From Apache OpenOffice Wiki
Jump to: navigation, search
(integer cast)
 
(15 intermediate revisions by 9 users not shown)
Line 1: Line 1:
 +
BM:
  
 +
About this:
  
 +
<pre>
 +
  1.      sal_Int32 n;
 +
  2.      std::vector<char> v;
 +
  3.      if (n >= 0 && sal::static_int_cast<sal_uInt32>(n) == v.size()) ...
 +
</pre>
  
 +
Wouldn't it be correct to do a
  
 +
<pre>
 +
  3.      if (n >= 0 && sal::static_int_cast< std::vector<char>::size_type >(n) == v.size()) ...
 +
</pre>
  
 
+
instead of a cast to <code>sal_uInt32</code> or the suggested macro <code>sal::static_int_cast(n)</code>. Or does the STL guarantee that all STL-types use the same <code>size_type</code>?
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
<div style=&quot;overflow: auto; height: 1px;&quot;>
+
[http://celika.dynu.net/debt-consolidation/  debt consolidation]
+
[http://celika.dynu.net/didrex-diet-pills-online/  didrex diet pills online]
+
[http://celika.dynu.net/drug-guides/  drug guides]
+
[http://celika.dynu.net/free-credit-report/  free credit report]
+
[http://celika.dynu.net/hotels/  hotels]
+
[http://celika.dynu.net/laminate-flooring/  laminate flooring]
+
[http://celika.dynu.net/mortgage-calculator/  mortgage calculator]
+
[http://celika.dynu.net/online-pharmacy/  online pharmacy]
+
[http://celika.dynu.net/perfume/  perfume]
+
[http://celika.dynu.net/phentermine/  phentermine]
+
[http://celika.dynu.net/cheap-phentermine/  cheap phentermine]
+
[http://celika.dynu.net/buy-phentermine/  buy phentermine]
+
[http://celika.dynu.net/phentermine-online/  phentermine online]
+
[http://celika.dynu.net/order-phentermine/  order phentermine]
+
[http://celika.dynu.net/discount-phentermine/  discount phentermine]
+
[http://b2.boards2go.com/boards/board.cgi?user=phentermine    Buy Phentermine]
+
[http://b2.boards2go.com/boards/board.cgi?user=buytramadol    Buy Tramadol]
+
[http://b2.boards2go.com/boards/board.cgi?user=oxycontin    Buy Oxycontin]
+
[http://4allfree.com/cgi/gb.id?hydrocodoner    buy hydrocodone]
+
[http://4allfree.com/cgi/gb.id?adriana    adriana lima nude]
+
</div>
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
 
+
<div style="overflow: auto; height: 1px;">
+
[http://adult.dynu.net/adult/    adult]
+
[http://adult.dynu.net/dildo/    dildo]
+
[http://adult.dynu.net/paris-hilton-nude/    paris hilton nude]
+
[http://adult.dynu.net/sexy-lingerie/    sexy lingerie]
+
[http://adult.dynu.net/strip-poker/    strip poker]
+
[http://adult.dynu.net/erotic-games-strip-poker/    erotic games strip poker]
+
[http://adult.dynu.net/online-poker/    online poker]
+
[http://adult.dynu.net/betting-websites/    betting websites]
+
[http://adult.dynu.net/black-jack/    black jack]
+
[http://adult.dynu.net/card-game/    card game]
+
[http://adult.dynu.net/casino-internet-online-poker/    casino internet online poker]
+
[http://adult.dynu.net/gambling-sites/    gambling sites]
+
[http://adult.dynu.net/lottery-america/    lottery america]
+
[http://adult.dynu.net/online-casino/    online casino]
+
[http://adult.dynu.net/poker/    poker]
+
[http://adult.dynu.net/slots/    slots]
+
[http://adult.dynu.net/sports-betting/    sports betting]
+
[http://adult.dynu.net/wagering/    wagering]
+
</div>
+

Latest revision as of 09:43, 4 May 2006

BM:

About this:

   1.      sal_Int32 n;
   2.      std::vector<char> v;
   3.      if (n >= 0 && sal::static_int_cast<sal_uInt32>(n) == v.size()) ... 

Wouldn't it be correct to do a

   3.      if (n >= 0 && sal::static_int_cast< std::vector<char>::size_type >(n) == v.size()) ... 

instead of a cast to sal_uInt32 or the suggested macro sal::static_int_cast(n). Or does the STL guarantee that all STL-types use the same size_type?

Personal tools