On 26/06/2025 at 16:22, Markus Elfring wrote: >>> I am unsure if the check reordering would be desirable for this function implementation. >> >> Ah, you want to confirm whether >> >> usb_endpoint_dir_in(ep) && usb_endpoint_xfer_bulk(ep) >> >> is the same as >> >> usb_endpoint_xfer_bulk(ep) && usb_endpoint_dir_in(ep) >> >> ? > > Exactly, yes. > > Commutativity can probably be applied in this case. > But the different execution order will influence the corresponding run time characteristics. > https://en.wikipedia.org/wiki/Short-circuit_evaluation > https://en.wikipedia.org/wiki/Commutative_property > > The data processing order from known API function implementations might get priority > also at discussed source code places in the near future. Yes. This is what I tried to explain in my previous message: that the short circuit evaluation may impact the result when there is an undefined behaviour but that it is not the case here. Yours sincerely, Vincent Mailhol