Tag Archives: C++

Zeroing Memory is Hard (VC++ 2015 arrays)

Quick, what’s the difference between these two C/C++ definitions of initialized local variables? char buffer[32] = { 0 };char buffer[32] = {}; One difference is that the first is legal in C and C++, whereas the second is only legal … Continue reading

Posted in Performance, Programming, Visual Studio | Tagged , , | 22 Comments

Stop using strncpy already!

I keep running into code that uses strcpy, sprintf, strncpy, _snprintf (Microsoft only), wcsncpy, swprintf, and morally equivalent functions. Please stop. There are alternatives which are far safer, and they actually require less typing. The focus of this post is … Continue reading

Posted in Code Reliability, Visual Studio | Tagged , , , , | 74 Comments