Why do ZeroMemory, etc. exist when there are memset, etc. already?

前端 未结 8 1060
萌比男神i
萌比男神i 2020-12-10 00:55

Why does ZeroMemory(), and similar calls exist in the Windows API when there are memset and related calls in the C standard library already? Which ones should I

8条回答
  •  囚心锁ツ
    2020-12-10 01:31

    Actually, what you want to use is SecureZeroMemory().

    An optimizing compiler can remove calls to memset(), and SecureZeroMemory() is designed to prevent this.

    I used to think the ZeroMemory() calls were unnecessary until I came across this fact.

提交回复
热议问题