Clearing all temporary variables of functions after execution

Akif Ozkan
  • Akif Ozkan

    Akif Ozkan - 2013-03-13


    I want to clear all temporary and local variables after execution of a function so as not to leave a trace.

    I think clearing registers, local variables could easily be done by assigning them to 0.

    Hovewer, Althhough I use these linker options
    #pragma nogcse
    #pragma noinduction
    ASM produces some temporary variables like:

    Also, I ask the solution to temporary variables.

    Do I miss anything else that a function could use?
    How can I be sure that function clears everything it used?

    Thanks in advance.

  • Maarten Brock

    Maarten Brock - 2013-03-15

    You can clear the registers by using inline assembly.
    And if you make the function __reentrant all local and temporary variables will be placed on the stack. Again in assembly you can clear everything between BP+1 and SP.


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks