This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

reentrant error!

#include <string.h>

void testok(void) reentrant
{ char buff[20];

buff[0]=1;

strcpy(buff,"hello");

//ok: buff = "hello"

}

void testfail(void) reentrant
{ char buff[20];

buff[0]=1; buff[2]=2;

strcpy(buff,"hello");

//fail: buff = "ello"

}

void main(void)
{ testok(); testfail();
}

Parents
  • Not strcpy () error asm view call strcpy, the buff (mov Rx) address error

    It cannot be in error, because the whole code is you posted is functionally equivalent to

    void main(void)
    {
       // do nothing
       // OH, and by the way, what do you think happens after this line?
    }
    

    It doesn't matter one bit how the compiler invoked strcpy(), nor even whether it called strcpy() at all, because immediately after that line in the source the lifetime of the affected variable ends anyway. So whatever happened to this variable doesn't matter.

Reply
  • Not strcpy () error asm view call strcpy, the buff (mov Rx) address error

    It cannot be in error, because the whole code is you posted is functionally equivalent to

    void main(void)
    {
       // do nothing
       // OH, and by the way, what do you think happens after this line?
    }
    

    It doesn't matter one bit how the compiler invoked strcpy(), nor even whether it called strcpy() at all, because immediately after that line in the source the lifetime of the affected variable ends anyway. So whatever happened to this variable doesn't matter.

Children