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

Add MSVC support by using a DEFER macro and increasing the evaluation depth. #7

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Erlkoenig90
Copy link

In addition to my previous PR #6, this branch adds support for the MS Visual C++ compiler, fixing bug #4 . To achieve this, evaluation of the variadic macros is delayed by a "DEFER" macro. This requires the evaluation depth to be increased, by adding further levels to the "EVAL" recursion. Oddly, a different amount of levels is required for MSVC and GCC. The approach for generating commas for MAP_LIST had to be changed into using three instead of two different variants of MAP_LIST to have all instantiations except the first one emit a comma. I am not sure that this is the most elegant solution, but it appears to work (GCC 7.2.0, MSVC 2017 15.6.4).

These macros allow the user to pass a single value to all invocations of the user macro,
and the *_I variants additionally pass the index of the invocation as an integer literal.
This requires a list of predefined increment operations. Updated the documentation
accordingly, and added an overview and a link to the µSer library to README.md.
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