C++ inlining of references (original) (raw)
Andrew Haley aph at redhat.com
Tue Mar 21 10:15:00 UTC 2017
- Previous message: C++ inlining of references
- Next message: RFR(XXXL): 8177046 Update Graal
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 21/03/17 09:25, Ioi Lam wrote:
Because the common header modifies 2 variables, there's no easy way to pass them back easily. So I pass them as references to the inline function.
Can I expect modern C++ compilers to always generate equally optimal code for the before/after cases?
Yes. Note that there is unlikely to be any advantage to a reference over taking the address of a variable, because they get lowered to the same thing anyway. Use whatever is easiest for people to read.
Andrew.
- Previous message: C++ inlining of references
- Next message: RFR(XXXL): 8177046 Update Graal
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]