[Development] #pragma or xxx_s functions

Kurt Pattyn pattyn.kurt at gmail.com
Wed Dec 18 07:35:35 CET 2013

For a lot of the standard C functions, Microsoft has implemented "safe" versions.
Functions like sprintf, scanf, strcpy, aso have "safe" counterparts with an _s suffix: sprintf_s, scanf_s, aso
When the "non-safe" functions are used, the Microsoft compiler generates a warning that these functions should be replaced by their "safe" counterparts.
There are 3 ways to get rid of these warnings: 
1. replacing those functions, 
2. using a #pragma
3. using a compiler flag

What is the recommended way to get rid of these warnings in the Qt sources?

I solved these warnings by replacing the calls with the safe versions, but the patch was rejected because it was recommended to use #pragmas.
Before proceeding and going through the sources again, I would like to know the recommended practice within Qt.


More information about the Development mailing list