-
Notifications
You must be signed in to change notification settings - Fork 1
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
Replace min/max macros with standard C++ #22
Conversation
Wanted to be sure that I can spend more time on this if you want, or you can merge this now. No doubt there's several conversion warnings from numbers being cast to int then downcast back to int16 or smaller. |
To be clear, modaccent works fine and regenerates yygram.cpp with the modified grammar.acc file? |
On the latest commit I edited Then tested loading a game on |
Sorry, I forgot to comment. Before this can be merged, this must be tested with compile and a short game played verifying the module is valid. The grammar is used to build the compiler. |
Was able to play a short game on this PR without any noticeable issues other than losing my saves from the version bump on master. |
The simplest solution was to add `using` to replace the macros exactly with the C++ functions. Platform toolset has been increased to v143. This was probably not needed for this PR but it is needed for C++17 and libtcod. An explicit type must be given when int constants are mixed with smaller types. The sources which needed to be updated includes `Grammar.acc`. Refactor Grammar.acc to use std:: namespace
Not even a using alias in the headers anymore. Found some subtle edge cases by doing this. Also updates min/max in unused code. Use `define NOMINMAX` instead of `undef` to prevent Windows headers of defining min/max.
I was able to do what I wanted and switch everything over to using the standard namespace. This is rebased onto the commits which verify generated files, and I've been play-testing on this branch. When are you comfortable merging this? |
I want to do a branch shuffle. On one hand we want to be merging things like this and working towards an alpha release with them in, and on the other there should always be a stable codebase to do releases from with critical bug fixes. So I kind of want to:
Then we have a viable project that can do releases with a known stability now. However, the goal is not to compete with the dev branch, that is a waste of time and effort. master would only have crash bugs merged and should be able to release often with minimal effort and minimal testing, any feature changes in addition to code modernisation would happen in dev. |
Instead of force pushing onto master again you should instead make a |
Yes, good idea, let's go with stable. That's less work. What do you mean by "Cherry-picking or backporting critical bug-fixes can work with tags alone if that's the goal." ? |
It's perhaps complex compared to a stable branch, but you can fork off a tag, add the fixes, then tag the result as a new release, but that is more for semantic versioning than for regular serial releases. |
Well, we have a plan for the branches. I'll merge this. |
The simplest solution was to add a
using
alias to replace the macros with the C++ functions.Platform toolset has been increased to v143. This was probably not needed for this PR but it is needed for C++17 and libtcod.
An explicit type must be given when int constants are mixed with smaller types. This mostly meant going around and adding
<int>
to everything.The sources which needed to be updated includes
Grammar.acc
.Unless there's anything unexpected, this closes #12
I'll look at this again when I'm more awake before marking this as ready.