[PATCH] Optimize strlen/strcmp/strncmp/strncpy/fputs on ?: or comma expressions

Aaron Lehmann aaronl@vitelus.com
Tue Jun 24 00:18:00 GMT 2003


On Mon, Jun 23, 2003 at 03:19:16PM +0200, Jakub Jelinek wrote:
> Hi!
> 
> This is something I've noticed in Roger's sample code.
> j = strlen (i++ ? "foo" : "bar");
> can be optimized into
> i++; j = 3;
> and similarly other functions.

How many times does this optimization trigger during a bootstrap?

Does anybody actually write code like that?



More information about the Gcc-patches mailing list