tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] Small patch


From: Stephan Beal
Subject: Re: [Tinycc-devel] Small patch
Date: Thu, 31 Jan 2013 12:34:27 +0100

On Thu, Jan 31, 2013 at 12:07 PM, Thomas Preud'homme <address@hidden> 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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]