recp / cglm

📽 Highly Optimized 2D / 3D Graphics Math (glm) for C

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Visual Studio 2022 C17 Compiler unsafe sprintf error C4996

adotspooner opened this issue · comments

Hi :) I get the following error with my project settings in Visual Studio 2022 with the C17 Compiler.
I would like to let this security warning feature enabled, maybe cglm could upgrade to the secure versions of the print functions?

Error C4996 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. 
To disable deprecation, use _CRT_SECURE_NO_WARNINGS.
cglm-0.9.4\include\cglm\io.h	135

Hi @adotspooner,

Thanks for reporting this, eb3a51e should do the job. IIRC, sprintf_s is not standard below C11 so snprintf() is enough for now, I think.

Hi @recp,

thank you for this ultra fast response, I will build cglm with this commit tomorrow and try it with my VS project.

Hi @recp, I tested my code with the build of the master branch at eb3a51e and I could remove the _CRT_SECURE_NO_WARNINGS without getting errors. Thank you again!

@adotspooner great to hear that!

Thanks