Clearing all temporary variables of functions after execution

Akif Ozkan
2013-03-13
2013-03-15
  • Akif Ozkan
    Akif Ozkan
    2013-03-13

    Hi,

    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:
    "name_slocx_1_0"

    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.