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

Use virtual operators in vector.h #1287

Merged
merged 2 commits into from
Dec 27, 2024
Merged

Conversation

foxtacles
Copy link
Member

@foxtacles foxtacles commented Dec 27, 2024

In reference to: #1193

I've been thinking more about this, and considering that even in the BETA, all the arithmetic operations always and consistently use dynamic dispatch, I figured whatever it is, it must have been present in the BETA as well.

Then I randomly tried making the arithmetic operations virtual operator functions, and it turns out that for some arcane reason, MSVC 4.20 always uses dynamic dispatch for virtual functions that are operators, even if they for all intents and purposes should be inlined. Since operators in C++ are essentially just regular functions (with an extra way of calling them using the operator syntax) I did not expect that the compiler would treat them differently, but here we are.

I think this solves the mystery once and for all. It should also clean up BETA matches since the calls are now correct.

@foxtacles foxtacles changed the title Use virtual operators in vector.h Use virtual operators in vector.h Dec 27, 2024
@foxtacles foxtacles merged commit 669454a into isledecomp:master Dec 27, 2024
12 checks passed
@foxtacles foxtacles deleted the ops branch December 27, 2024 17:37
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

Successfully merging this pull request may close these issues.

1 participant