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

MSVC compiler warning #218

Open
gha88 opened this issue Jun 4, 2022 · 2 comments
Open

MSVC compiler warning #218

gha88 opened this issue Jun 4, 2022 · 2 comments

Comments

@gha88
Copy link

gha88 commented Jun 4, 2022

Using version v.2.1.0 and with visual studio compiler at level 3 I received the following errors:

error C4996: 'getenv': This function or variable may be unsafe. error C4996: 'strncat': This function or variable may be unsafe. error C4996: 'strncat': This function or variable may be unsafe. error C4996: 'strncat': This function or variable may be unsafe. error C4996: 'fopen': This function or variable may be unsafe. error C4996: 'strcpy': This function or variable may be unsafe.
Of course I can avoid the deprecation using _CRT_SECURE_NO_WARNING but I would prefer do not.

Moreover I received some other warning like C26451 about casting value to a wider type.

@zao
Copy link

zao commented Jun 7, 2022

C4996 is originally a warning, are you building with warnings-as-errors?
If so, you may want to exclude it from the set of warnings you treat as errors as it's quite an opinionated warning and recommends non-standard functions just because Microsoft happens to have alternative implementations of them.

@gha88
Copy link
Author

gha88 commented Jun 7, 2022

Yes I'm building with warnings as error.
As I stated before I can avoid them as you suggest but I think it's not a solution.
This configuration is the default on visual studio 19.
I think in this case the best solution should be to use a define in case of windows to use the Microsoft implementations.
Don't you agree?

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

No branches or pull requests

2 participants