Often, one sees code like this:<br><br>string s;<br>size_t length_of_string = s.size();<br><br>Although this is correct, and should not bite you in the buttocks on any common implemenetation, it's not *pedantically* correct and fully portable. The return type of string::size is by definition string::size_type, and although the common existing implementations use size_t, these two don't have to be the same type, and could result in unexpected weirdness.<br>
Is there any warning available (or uberhaupt implementable) in Clang that checks these kinds of implementation-dependent conversions, and perhaps suggest the type better suited (or a static_cast to the user's type)?<br>
<br>I understand this is pure pedantry and of little practical use (especially the string::size() case), but I would figure there could be larger bugs exposed in a more general case where there is an unnecessary implicit conversion. (although that word would mean these shouldn't be warned for at all, as it's a predefined language feature).<br>
<br>Thanks!<br><br>Ruben<br>