Talk:Writing warning-free code

From Apache OpenOffice Wiki
Revision as of 09:43, 4 May 2006 by Bm@openoffice.org (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

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