State of “memset” functionality in C++ with modern compilers

前端 未结 12 1746
我寻月下人不归
我寻月下人不归 2021-02-12 16:03

Context:

A while ago, I stumbled upon this 2001 DDJ article by Alexandrescu: http://www.ddj.com/cpp/184403799

It\'s about comparing various ways to initialize

12条回答
  •  误落风尘
    2021-02-12 16:26

    The year isn't 2001 anymore. Since then, new versions of Visual Studio have appeared. I've taken the time to study the memset in those. They will use SSE for memset (if available, of course). If your old code was correct, statistically if will now be faster. But you might hit an unfortunate cornercase. I expect the same from GCC, although I haven't studied the code. It's a fairly obvious improvement, and an Open-Source compiler. Someone will have created the patch.

提交回复
热议问题