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

Remove _cpp_ auto-escaping #3264

Open
bernardnormier opened this issue Dec 12, 2024 · 0 comments
Open

Remove _cpp_ auto-escaping #3264

bernardnormier opened this issue Dec 12, 2024 · 0 comments

Comments

@bernardnormier
Copy link
Member

C++ (unlike C#) does not provide a standard mechanism to escape identifiers that conflict with keywords.

slice2cpp auto-escapes identifiers that conflict with C++ keywords by adding a _cpp_ prefix to the mapped C++ identifier:

https://doc.zeroc.com/ice/3.7/language-mappings/c++11-mapping/client-side-slice-to-c++11-mapping/c++11-mapping-for-identifiers

The resulting identifier (say _cpp_while) is not particularly nice.

Proposal

Update slice2cpp to not auto-escape identifiers that conflict with C++ keywords. When this happens, the generated C++ code won't compile and users should use cpp:identifier:xxx to map this Slice identifier to the C++ identifier of their choice.

See #2864.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants