Post

Replies

Boosts

Views

Activity

Reply to Disable sprintf deprecation warning
If you really want to suppress the warning, you can disable -Wdeprecated-declarations (perhaps via -Wno-deptecated-declarations) everywhere you might see a use of sprintf. If you want to be surgical about disabling the warning, you can #pragma clang diagnostic around each use. The best option, of course, is not to suppress but to transition away from an interface that’s so easy to misuse. You can migrate the uses of sprintf to something else, such as snprintf. snprintf does guarantee NUL-termination, so I think your lack of enthusiasm for it as a replacement is misplaced.
Nov ’22