c42f / tinyformat

Minimal, type safe printf replacement library for C++
537 stars 75 forks source link

Empty FormatArg() constructor doesn't initialize members #42

Closed krlmlr closed 7 years ago

krlmlr commented 7 years ago

https://github.com/c42f/tinyformat/blob/46a6d778e7abafa057efc546197603d32719bfc5/tinyformat.h#L490

This confuses Coverity, and also looks unsafe:

screenshot from 2017-10-02 09-25-09

Reference: https://github.com/RcppCore/Rcpp/issues/760

nigels-com commented 7 years ago

Agreed. NULLing out the pointers would be correct.

c42f commented 7 years ago

Thanks Nigel for #43 - this should eliminate the warning (please feel free to reopen if you still have issues).

As a side note, I'm quite sure this was in fact a false alarm as other internal implementation details ensure these pointers are always initialized. However, it's always good to keep the warnings to a minimum.

krlmlr commented 7 years ago

Thanks. Agreed that the implementation may have been correct before, but it still feels safer to initialize.

krlmlr commented 7 years ago

Thanks. Agreed that the implementation may have been correct before, but it still feels safer to initialize.