Also worth noting clippy will warn about writing functions with too many arguments for the same reason listed in TFA
https://rust-lang.github.io/rust-clippy/master/index.html#to...
Re:N-Params vs. Single Param
by carlos-menezes on Thursday April 17, 2025 @03:54PM
(#43721415)
C++ for reference: https://godbolt.org/z/7G6qxK6T8
Re:N-Params vs. Single Param
by hwpythonner on Thursday April 17, 2025 @04:20PM
(#43721777)
Try compiling with optimizations. I think by default this site doesn't add optimization flags.
Here what happens with optimizations: https://godbolt.org/z/G18zd7chP
Look at the registers usages vs stack
Re:N-Params vs. Single Param
by carlos-menezes on Thursday April 17, 2025 @04:25PM
(#43721818)
Got it! Thanks for the link.
Re:N-Params vs. Single Param
by physicsguy on Thursday April 17, 2025 @03:57PM
(#43721470)
If you add a third argument you get different assembly
Functions with plain arguments and a struct both produce identical assembly output.