4 ms·
Develop your c code in OpenBSD. The linker admonishes you any time you use unsafe string functions. warning: strcpy() is almost always misused, please use
by dmm 13y ago
Develop your c code in OpenBSD. The linker admonishes you any time you use unsafe string functions.
warning: strcpy() is almost always misused, please use strlcpy()
- groovy2shoes 13y agoBy default, Microsoft's C compiler will also give you warnings for unsafe functions. At least, it did the last time I used it a few years ago.
- ygra 13y agoIt still does. Microsoft also banned a lot of C functions from usage internally [1]. For codebases that need to build in VC and other compilers I'm not yet sure how to really solve this apart from _CRT_SECURE_NO_WARNINGS. [1]: http://msdn.microsoft.com/library/bb288454.aspx http://msdn.microsoft.com/library/bb288454.aspx
- anon4 13y agoHow about just taking BSD's functions and using them? strlcpy, strlcat, snprintf, etc. are all easily portable and libraries probably already exist for MS's compiler.
- nitrogen 13y agoThe thing I didn't like about Microsoft's approach is that they also flagged some of the safer C functions, and introduced a new bunch of non-standard functions, the *_s functions. Those functions were eventually added to the C11 standard at Microsoft's suggestion, but until that point the MS C compiler would admonish programmers to write unportable code.