On Wednesday, September 7, 2022, Steffen Nurpmeso <stef...@sdaoden.eu>
wrote:
>  |> +      /* Overflow check: since arithmetic expressions are rarely \
>  |> long enough
>  |> +       * to come near this limit, xxx laxe & fuzzy, not exact; max \
>  |> U32_MAX! */
>  |> +      if(su_64( i > U32_MAX || ) i >= UZ_MAX / 2 ||
>  |
>  |I have to admit that the amount of macro maze makes it really hard to
>  |read ;)
>
> Well it is easier than having lots of #ifdef #else #endif blocks
> in my opinion.  On 32-bit the above would spit out a warning
> (possibly, i have not really looked what compiler/linker flags
> busybox uses) because i>U32_MAX can never be true.  I mean i could
> say i>=U32_MAX-1 or what, sure.  The above is "laxe and fuzzy"
> anyhow.  :-)

Compiler will optimize out always-false expressions without giving any
warning.
It's common for C code to produce many expressions like this that evaluate
to constants (boolean or integer) at compile time as results of macro
expansion, so no warnings should be given.

The expression with a macro like `su_64( i > U32_MAX || )` looks really
ugly to me. If what you are achieving is to remove statements that are
always false (under certain preprocessor condition), just let the compiler
do the job.
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to