3 ms·
There is no performance penalty in any modern compiler that I am aware of (effectively no code will be emitted). You can have a look here: https://godbolt.org/
by vnorilo 7y ago
There is no performance penalty in any modern compiler that I am aware of (effectively no code will be emitted).
You can have a look here:
https://godbolt.org/z/DmeYL- https://godbolt.org/z/DmeYL-
- xleviator 7y agoSure within a single compilation unit. Otherwise, I like dearrifling's suggestion.
- vnorilo 7y agoThe example also shows a call to a different translation unit. There's no code for passing the empty struct. There's also none for handling it, as you can see from the assembly output. The one byte rule does nothing here, because its value is undefined and its address not observable. edit: if you find a case where an empty struct parameter causes code to be emitted, let's consider filing bugs.