K
Kobu
Hello,
Wonder if the below double access to s is undefined behaviour? Works
fine, but I know "works" can still be a consequence of undefined
behaviour.
#include <string.h>
void mystrcat(char *s, const char *t)
{
/* is the below undefined behaviour ? */
s += strlen(s);
while(*s++ = *t++)
; /* empty statement */
}
S is accessed twice (which is a no no), yet the statement "feels" right
to me.
Wonder if the below double access to s is undefined behaviour? Works
fine, but I know "works" can still be a consequence of undefined
behaviour.
#include <string.h>
void mystrcat(char *s, const char *t)
{
/* is the below undefined behaviour ? */
s += strlen(s);
while(*s++ = *t++)
; /* empty statement */
}
S is accessed twice (which is a no no), yet the statement "feels" right
to me.