L
luser- -droog
How worried shoud I be about this warning?
It's only modified once, right?
cat tos.c && make tos
#include <stdio.h>
int main(void) {
/* stack */
char stac[100];
char *tos = stac;
/* string */
char *str = "a string";
char *s;
/* push some elements */
for (s = str; *s; s++)
*tos++ = *s;
/* copy elements */
{
int n = tos-stac;
*tos++ = tos[-n]; /* undefined? */
}
*tos++ = 0;
puts(stac);
return 0;
}
/* eof */
cc -g -Wall tos.c -o tos
tos.c: In function 'main':
tos.c:19: warning: operation on 'tos' may be undefined
It's only modified once, right?
cat tos.c && make tos
#include <stdio.h>
int main(void) {
/* stack */
char stac[100];
char *tos = stac;
/* string */
char *str = "a string";
char *s;
/* push some elements */
for (s = str; *s; s++)
*tos++ = *s;
/* copy elements */
{
int n = tos-stac;
*tos++ = tos[-n]; /* undefined? */
}
*tos++ = 0;
puts(stac);
return 0;
}
/* eof */
cc -g -Wall tos.c -o tos
tos.c: In function 'main':
tos.c:19: warning: operation on 'tos' may be undefined