Should C++ programmer avoid memset?

后端 未结 11 1422
遇见更好的自我
遇见更好的自我 2020-12-02 20:17

I heard a saying that c++ programmers should avoid memset,

class ArrInit {
    //! int a[1024] = { 0 };
    int a[1024];
public:
    ArrInit() {  memset(a, 0         


        
11条回答
  •  北荒
    北荒 (楼主)
    2020-12-02 20:46

    There's no real reason to not use it except for the few cases people pointed out that no one would use anyway, but there's no real benefit to using it either unless you are filling memguards or something.

提交回复
热议问题