opensim-org / opensim-core

SimTK OpenSim C++ libraries and command-line applications, and Java/Python wrapping.
https://opensim.stanford.edu
Apache License 2.0
783 stars 316 forks source link

Suppress remaining `gcc` compiler warnings #3659

Closed nickbianco closed 9 months ago

nickbianco commented 9 months ago

Brief summary of changes

This PR is mainly intended to address any remaining gcc compiler warnings not suppressed in the previous two PRs (#3657 and #3658). The changes include:

Testing I've completed

Looking for feedback on...

CHANGELOG.md (choose one)


This change is Reviewable

adamkewley commented 9 months ago

Overall, looks fine and you can merge it etc. but, just in case you end up refactoring stuff like this later, a safer pattern for snprintf with stack-allocated buffers is:

std::array<char, 128> buf;
std::snprintf(buf.data(), buf.size(), "blah %i", i);

Because there's one unambiguous location for the size of the buffer

(not dissing this PR: the existence of these snprintfs are clearly legacy)

nickbianco commented 9 months ago

I've addressed @adamkewley's specific comment. Let's switch to the safer buffer pattern in a future PR.