On Thu, Jan 31, 2013 at 12:07 PM, Thomas Preud'homme <[email protected]>wrote:

> > -                strcpy(buf, "__bound_");
> > -                strcat(buf, name);
> > +                snprintf(buf, sizeof(buf), "__bound_%s", name);
>

strcpy and strcat are C89 and C99 while snprintf is only C99.
>

The semantics of the above variants are not the same, are they? strcpy()
and strcat() are both writing to the same address in buf, i.e. strcat is
overwriting what strcpy() copied into buf. So the end result, unless i'm
sorely mistaken, is a copy of the name with the __bound_ prefix. strncat()
is c89, BTW.

-- 
----- stephan beal
http://wanderinghorse.net/home/stephan/
http://gplus.to/sgbeal
_______________________________________________
Tinycc-devel mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel

Reply via email to