[U-Boot-Users] [RFC/PATCH] Add expr command
Scott Wood
scottwood at freescale.com
Wed Feb 13 17:06:51 CET 2008
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
More information about the U-Boot
mailing list