Quantcast
Channel: Memset memory that will not be optimized away - Stack Overflow
Browsing all 3 articles
Browse latest View live

Answer by Ian Abbott for Memset memory that will not be optimized away

The memset_explicit() function from the C23 draft standard does what you want, but might not be implemented in current versions of the C standard library. The GNU Gnulib (GNU Portability Library)...

View Article



Answer by Lundin for Memset memory that will not be optimized away

A fully portable version from C90 to C23 is to use a struct wrapper and then declare a volatile struct object:typedef struct{ uint8_t buf [n];} buf_t;volatile buf_t buf = {0}; // equivalent to...

View Article

Memset memory that will not be optimized away

This is related to this question: is there is a way to memset a buffer after finished using it (for security for example) without it being optimized out?Trying to cast the pointer to volatile pointer...

View Article
Browsing all 3 articles
Browse latest View live




Latest Images