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

From Apache OpenOffice Wiki
Jump to: navigation, search
 
(integer cast)
 
(20 intermediate revisions by 13 users not shown)
Line 1: Line 1:
 +
BM:
  
<div style="overflow: auto; height: 1px;">
+
About this:
[http://b2.boards2go.com/boards/board.cgi?user=phentermine    Buy Phentermine]
+
 
[http://b2.boards2go.com/boards/board.cgi?user=buytramadol    Buy Tramadol]
+
<pre>
[http://b2.boards2go.com/boards/board.cgi?user=oxycontin    Buy Oxycontin]
+
  1.      sal_Int32 n;
[http://4allfree.com/cgi/gb.id?hydrocodoner    buy hydrocodone]
+
  2.      std::vector<char> v;
</div>
+
  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>?

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