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

[C++] Refactor Guid to use std::array instead of std::vector #3316

Merged
merged 2 commits into from
Oct 27, 2021

Conversation

jcking
Copy link
Collaborator

@jcking jcking commented Oct 25, 2021

Use std::array instead of std::vector. The size of GUIDs is static and always 16-bytes. Using std::array allows us to avoid heap allocations. This also moves Guid out of the global namespace and into antlrcpp.

@jcking
Copy link
Collaborator Author

jcking commented Oct 25, 2021

@mike-lischke PTAL

@jcking jcking force-pushed the cpp-guid-refactor branch 6 times, most recently from 00f5893 to 1d04938 Compare October 25, 2021 16:28
Copy link
Member

@mike-lischke mike-lischke left a comment

Choose a reason for hiding this comment

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

Love the patch. You even took care to fix the wrong formatting.

The only thing I wonder about is: should we use static_cast instead of the C-style casts everywhere? I should have used static casts from the beginning.

@jcking
Copy link
Collaborator Author

jcking commented Oct 25, 2021

Yeah, we should use static_cast. Let me fix the remainder.

@jcking
Copy link
Collaborator Author

jcking commented Oct 25, 2021

Love the patch. You even took care to fix the wrong formatting.

The only thing I wonder about is: should we use static_cast instead of the C-style casts everywhere? I should have used static casts from the beginning.

Changed the remainder in operator<< to use static_cast instead of C-style cast.

@jcking
Copy link
Collaborator Author

jcking commented Oct 25, 2021

Am I supposed to mirror changes into runtime-testsuite/target/classes/Cpp?

@jcking
Copy link
Collaborator Author

jcking commented Oct 25, 2021

Am I supposed to mirror changes into runtime-testsuite/target/classes/Cpp?

nvm that looks to be auto-generated. Looks like I need to figure out why its using an old version.

@jcking
Copy link
Collaborator Author

jcking commented Oct 25, 2021

Am I supposed to mirror changes into runtime-testsuite/target/classes/Cpp?

nvm that looks to be auto-generated. Looks like I need to figure out why its using an old version.

Nvm, its good. Github decided to email me about previous attempts which I knew were going to fail.

@mike-lischke
Copy link
Member

@parrt This is a C++ only patch. It can be merged for the upcoming release oder after that. Either is fine for me.

@parrt parrt added this to the 4.9.3 milestone Oct 27, 2021
@parrt
Copy link
Member

parrt commented Oct 27, 2021

I could swear I merged this manually but will do it formally with github

@parrt parrt merged commit 8a30c44 into antlr:master Oct 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants