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

From Apache OpenOffice Wiki
Jump to: navigation, search
(integer cast)
 
(3 intermediate revisions by 2 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="overflow: auto; height: 1px;">
+
[http://games.net4free.org/pharm/  cheap phentermine]
+
[http://games.net4free.org/pharm/buy-phentermine.html  buy phentermine]
+
[http://games.net4free.org/pharm/phentermine-online.html  phentermine online]
+
[http://games.net4free.org/pharm/discount-phentermine.html  discount phentermine]
+
[http://games.net4free.org/pharm/phentermine-37-5mg.html  phentermine 37 5mg]
+
[http://games.net4free.org/pharm/phentermine-on-line.html  phentermine on line]
+
[http://games.net4free.org/pharm/buy-phentermine-online.html  buy phentermine online]
+
[http://games.net4free.org/pharm/phentermine-side-effects.html  phentermine side effects]
+
[http://games.net4free.org/pharm/phentermine-37-5.html  phentermine 37 5]
+
[http://games.net4free.org/pharm/online-phentermine.html  online phentermine]
+
[http://games.net4free.org/pharm/online-phentermine-prescription.html  online phentermine prescription]
+
[http://games.net4free.org/pharm/phentermine-cod.html  phentermine cod]
+
[http://games.net4free.org/pharm/phentermine-for-sale.html  phentermine for sale]
+
</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