Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inline operators in fixpp.h return reference to local #10

Open
StrayLightning opened this issue Apr 16, 2018 · 0 comments
Open

Inline operators in fixpp.h return reference to local #10

StrayLightning opened this issue Apr 16, 2018 · 0 comments

Comments

@StrayLightning
Copy link

I haven't has a chance to look at the C++ standard, and there might be reasons or cases where this is okay. If the compiler guarantees to inline a function, the storage for the "local" notionally becomes local to the caller, so it could potentially be okay in some cases. However, g++ warns about these inline operators, and from looking at the unoptimised output they are not being inlined and the code emitted explicitly returns null.

This is worth bearing in mind for people who are porting the source to other toolchains.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant