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

100-item limit for REFL_AUTO #55

Closed
rpatters1 opened this issue Oct 15, 2021 · 2 comments
Closed

100-item limit for REFL_AUTO #55

rpatters1 opened this issue Oct 15, 2021 · 2 comments

Comments

@rpatters1
Copy link
Contributor

rpatters1 commented Oct 15, 2021

EDIT:

I figured out that refl-cpp can already handle >100 items. You just have to use the other syntax:

REFL_TYPE(MyType)
   REFL_FUNC(Func1)
   ...
   REFL_FUNC(Func193)
REFL_END

As far as I can tell, this syntax works identically to REFL_AUTO including support for user-defined properties. So my original enhancement request was moot. I'm leaving the rest of this issue here in case any other lost lamb comes looking for help with it. It would be helpful to call it out in the documentation as an alternative when there are >100 items in the REFL_AUTO list.

(Original text follows.)

=============================

I'm working with a pre-existing class framework that is risky to modify. I am finding myself exceeding or near-exceeding the 100-item limit in REFL-AUTO. Fine, I thought to myself, I'll just expand it to 200 in a fork. But then I hit an absurdly laughable limit in the Visual Studio 2019 compiler. It absolutely cannot and will not handle a macro with more than 127 arguments.

It would be nice if there were a way to continue REFL_AUTO for a class in a subsequent macro. I don't understand the refl-cpp code well enough to suggest a sensible syntax, but I'm thinking something along the lines of

/* fantasy syntax: see edit above. This makes no sense based on that edit, but it was my original post. */

REFL_AUTO
(
   type(mytype, continues()),
   func(func1),
   ...
   func(func99)
)

REFL_CONTINUES
(
   type(mytype),   // plus, ideally, the option to continue again with continues()
   func(func101),
   ...
)
@veselink1
Copy link
Owner

See also https://docs.microsoft.com/en-us/cpp/cpp/compiler-limits?view=msvc-160
The REFL_TYPE/REFL_END syntax works around that limitation.

@rpatters1
Copy link
Contributor Author

If REFL_TYPE/REFL_END is now the preferred syntax, it might be helpful to update the Doxygen pages to that effect. Or at least mention them as an alternative. What saved me was a random article about it on the internet. At first it seemed like the REFL_AUTO syntax had superseded the other, which is why I started out using it.

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

2 participants