Adventures with gcc: code vs object-code size

Marc Olzheim marcolz at stack.nl
Sun Mar 21 06:13:28 PST 2004


On Sun, Mar 21, 2004 at 07:45:43PM +1100, Peter Jeremy wrote:
> But (IMHO) this is a lot less clear than the former code (thought I admit
> I'm guilty of doing this quite a lot in my code).  Note that a modern C
> compiler is free to convert
>   strcpy(elemcopy, ":") == 0
> into
>   elemcopy[0] == ':' && elemcopy[1] == '\0'
> assuming the relevant header (<string.h>) is in scope.  (I was under the
> impression that gcc did this).

You're mixing up strcpy() with strcmp(), but you are right, unless
-fno-builtin is specified.

Marc


More information about the freebsd-hackers mailing list