Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

silence deprecation warning by replacing sprintf with snprintf #98

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

DominusExult
Copy link
Contributor

@DominusExult DominusExult commented Sep 29, 2022

latest Xcode gives out warnings that sprintf is deprecated because of security reasons. Quick silence of this warning is by replacing sprintf with snprintf.

'sprintf' is deprecated: This function is provided for compatibility reasons only. Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead.

@sergm
Copy link
Member

sergm commented Sep 30, 2022

Pfft, all 12 years I've been into this project, the Microsoft Visual C++ complained about this. Yet the suggested code change is done implicitly by using define _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES=1 that applies a magic template transform 🙂

@sergm
Copy link
Member

sergm commented Sep 30, 2022

According to cppreference.com, this change may also hurt portability. I guess the time has come to start detecting availability of C++11 in the library build system, so that we might make both the legacy and new worlds live in peace...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants