Hacker Newsnew | comments | show | ask | jobs | submitlogin

In GCC 4.4 and up you can use the following:

    #pragma GCC push_options
    #pragma GCC optimize ("O0")

    memset(a, 0, 3);

    #pragma GCC pop_options
'volatile' should also work, I don't see why there is any need to rewrite memset. Here is a related question on SO:

http://stackoverflow.com/questions/2219829/how-to-prevent-gc...

Edit: buried at the bottom of that post is another method:

    __attribute__((optimize("O0")))



Applications are open for YC Summer 2015

Guidelines | FAQ | Support | Lists | Bookmarklet | DMCA | Y Combinator | Apply | Contact

Search: