I used clang-tidy to automatically remove all redundant casts. It uses a compilation database
compile_commands.json which was generated with
bear. Not even sure if this is a wanted change, just thought I'd try to fix the source of warning messages before suppressing them 👍 . Thanks for your time.
@@ Coverage Diff @@ ## master #8906 +/- ## =========================================== - Coverage 90.18% 2.45% -87.73% =========================================== Files 151 149 -2 Lines 170780 165880 -4900 =========================================== - Hits 154022 4077 -149945 - Misses 16758 161803 +145045
Flags with carried forward coverage won't be shown. Click here to find out more.
|Impacted Files||Coverage Δ|
|... and 209 more|
Removing redundant type casts is nice, keeps the code clean.
It does appear to be incorrect in a few places though. Consider this one:
n = (long)(p - t) - stl_items[stl_groupitem[groupdepth]]
n = (p - t) - stl_items[stl_groupitem[groupdepth]]
subtracting two pointers results in size_t and "n" is a long. I would think the type cast is
still needed here. Try this on MS-Windows, which is the most picky about the difference
between size_t and integers. I believe size_t is 64 bits and long is 32 bits. Resulting in this error:
buffer.c(4403): warning C4267: '=': conversion from 'size_t' to 'long', possible loss of data
Aha. Figured it'd be too easy :). I didn't consider windows. Thanks for the explanation.
I'll go back to the drawing board and test on windows as well. Closing for now.