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

Compilation fail for messages with c++ keywords as field names #31

Open
mikepurvis opened this issue Jun 27, 2017 · 1 comment
Open

Comments

@mikepurvis
Copy link
Member

The Python generation code contains logic to append with underscore any fields that match a Python keyword:

https://github.com/ros/genpy/blob/45ecd5415fc4711a3afbdf3c2923b59fa742b436/src/genpy/generator.py#L224-L225

However, there's no such thing in the gencpp code, so we got tripped up when we had a message with established Python usage that had class as a field name, and then got used in C++ and wouldn't compile.

For now we've simply renamed our field to class_, but it would be great to see this transformation happen in gencpp itself, as it does in genpy.

@dirk-thomas
Copy link
Member

This would be an interesting feature. It should be made sure that e.g. an existing field class_ doesn't collide with a new field class which gets the suffix automatically to avoid the collision though.

Please consider to provide a pull request for this since the maintainer will likely not have time to implement the feature.

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