Name: Anonymous 2007-11-01 2:49
i made this thread to vent about C and it's terrible string management and how it's not my fault i need this done by noon tomorrow and i've had it for a month
char faggotWhine;
faggotWhine = >>1;
char *threadsafe() {
static char *value = 0;
if(value == 0) value = malloc(sizeof(char) * 512);
strcat(value, "hay guys, am i doin it rite ");
return value;
}
static variables are NOT thread safe, value is not freed and strcat will not overwrite the previous contents of value. Instead, it will keep writing until it gets to the end and writes past your 512 bytes on the 19th time it is called.