-
Notifications
You must be signed in to change notification settings - Fork 446
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
Mark RTTI methods as const / pure, so compiler could optimize subsequent calls, if necessary. #5049
Conversation
Recently I noticed that compiler was unable to optimize multiple calls to With this PR we add Note that |
…ent calls, if necessary. Signed-off-by: Anton Korobeynikov <[email protected]>
@vlstill Will you please take a look when you will have a chance? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks mostly good to me.
- Should the annotations be also on the base methods in the
RTTI::Base
? I think that would make sense. - Can you add a comment why these attributes are helpful?
These methods are pure virtual there as they are part of interface. They technically might be non pure / const as this is essentially an implementation detail (though I doubt anyone would implement things differently, but still the interface allows this :) ) Note that Other methods are non-virtual there and fully inlineable ad therefore there is no need for annotation there. |
Signed-off-by: Anton Korobeynikov <[email protected]>
Comments were added |
Yes, although the same is true for the implementation methods, as they can still be (in theory) overridden by non-pure/non-const versions, although that would probably violate some (at least implicit) requirements for RTTI methods. Therefore having the
True, therefore from the compilator standpoint it probably doesn't matter. It is really hard to find any resources on handling
Yes, I had only the virtual methods in mind. Overall, I am OK with having the attributes as is. |
No description provided.