Re: Optimising away memset() calls?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 08/10/14 03:15, Sandy Harris wrote:
> As I see it, though, and wrote in one thread:
> 
> " A real fix would make memset() do the right thing reliably; if the
> " programmer puts in memset( x, 0, nbytes) then the memory should
> " be cleared, no ifs or buts. I do not know or care if that means
> " changes in the compiler or in the library code or even both, but
> " the fix should make the standard library code work right, not
> " require adding a new function and expecting everyone to use it.
> 
> It seemed worth tossing this out for comment here.

That's not going to happen, given that memset_s() is a standard
idiom for this operation.

As it stands, even a call to memset_s() isn't sufficient: another
thread may not observe the memset_s() until a barrier has been
executed (and maybe not even then!) but I suppose it's better than
nothing.

Andrew.




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux