Skip to content

Instantly share code, notes, and snippets.

@milabs
Created April 7, 2015 22:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save milabs/5f370dca8990824a94be to your computer and use it in GitHub Desktop.
Save milabs/5f370dca8990824a94be to your computer and use it in GitHub Desktop.
memset_volatile
/*
* memset_volatile is a volatile pointer to the memset function.
* You can call (*memset_volatile)(buf, val, len) or even
* memset_volatile(buf, val, len) just as you would call
* memset(buf, val, len), but the use of a volatile pointer
* guarantees that the compiler will not optimise the call away.
*/
void * (* volatile memset_volatile)(void *, int, size_t) = memset;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment