On Wed, Feb 13, 2008 at 03:20:56PM +0100, Andreas Schweigstill wrote:
> +     /* Validate arguments */
> +     if ((argc != 5) || (strlen(argv[3]) != 1)) {
> +             printf("Usage:\n%s\n", cmdtp->usage);
> +             return 1;
> +     }
> 
> May we rely on the compiler optimizing the above expression so
> strlen() != 1 will only be evaluated if argc == 5 ?

Short-circuit evaluation isn't optimization, it's the semantics of the C
language.

-Scott

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
U-Boot-Users mailing list
U-Boot-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/u-boot-users

Reply via email to