Paul Eggert wrote:
> * lib/memset_explicit.c (memset_explicit):
> Remove special case for C==0 and MS-Windows.  The code isn’t
> needed for correctness
> ...
>  /* Set S's bytes to C, where S has LEN bytes.  The compiler will not
>     optimize effects away, even if S is dead after the call.  */
>  void *
>  memset_explicit (void *s, int c, size_t len)
>  {
> -#if defined _WIN32 && !defined __CYGWIN__
> -  if (!c)
> -    return SecureZeroMemory (s, len);
> -#endif
>  #if HAVE_EXPLICIT_MEMSET
>    return explicit_memset (s, c, len);
>  #elif HAVE_MEMSET_S

For compilers other than GCC and clang, we are betting on a trick with
'volatile'. I'm not sure it won't break in the future. But at least for
now, with MSVC, the unit tests still pass.

Bruno




Reply via email to