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

feat(C++): Support underlying_type for union #7954

Merged
merged 4 commits into from
May 15, 2023

Conversation

sssooonnnggg
Copy link
Contributor

No description provided.

@github-actions github-actions bot added c++ codegen Involving generating code from schema labels May 11, 2023
@sssooonnnggg sssooonnnggg force-pushed the master branch 2 times, most recently from f9c02b9 to 197a4c8 Compare May 11, 2023 11:31
src/idl_parser.cpp Show resolved Hide resolved
src/idl_parser.cpp Outdated Show resolved Hide resolved
tests/union_underlying_type_test.fbs Show resolved Hide resolved
Copy link
Collaborator

@dbaileychess dbaileychess left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The last thing I think is evolution test. It should be invalid to change the backing type of a union. Can you add this as well?

@sssooonnnggg
Copy link
Contributor Author

sssooonnnggg commented May 15, 2023

@dbaileychess Hi, I've added evolution tests for enum / union underlying type changes

@dbaileychess dbaileychess merged commit 1d3afb9 into google:master May 15, 2023
47 checks passed
@dbaileychess
Copy link
Collaborator

Great! Thanks for the multiple edits.

@jmillan
Copy link
Contributor

jmillan commented Sep 13, 2023

Hi @sssooonnnggg , would you please briefly comment what is this change about? I see no description at all in the PR.

Thanks

@sssooonnnggg
Copy link
Contributor Author

sssooonnnggg commented Sep 13, 2023

Hi @jmillan , the default union implementation use a single byte to store union associative enums, which limits union count must smaller than 256 , this feature allow union to specify an underlying type to store union associative enums with arbitrary integer type.

For example:

union LargeUnion: int { A, B, C, ...}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c++ codegen Involving generating code from schema lua
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants