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

Safer Core Library C type names #1391

Open
scolsen opened this issue Feb 23, 2022 · 4 comments
Open

Safer Core Library C type names #1391

scolsen opened this issue Feb 23, 2022 · 4 comments

Comments

@scolsen
Copy link
Contributor

scolsen commented Feb 23, 2022

The emitted names for some core library C types can conflict with definitions in other headers. For example, I'm trying to use some generated Carp C along with Apple framework headers--unfortunately one the the framework headers defines Pattern as a struct, while core defines it as char*

Should we prefix the emitted C names of core types to avoid this situation? e.g. CARP_Pattern? Or at least expose this as a compiler option?

@scolsen
Copy link
Contributor Author

scolsen commented Feb 23, 2022

similarly, delete is a keyword in objective-c++ -- so if that's something we'd want to support eventually we'd need ways around that to

@scolsen
Copy link
Contributor Author

scolsen commented Feb 23, 2022

We'll also need explicit casts in some cases in core to compiler with under c++

@scolsen
Copy link
Contributor Author

scolsen commented Feb 24, 2022

Thinking about these issue a bit more—I suppose the first question we should answer is whether or not we care about C++ compatibility. After all, C and C++ are two different languages. It might be best to stick to one and leave the rest up to particular project maintainers, if needed. That said, when it comes to code that's valid in C and C++ but only required by C++ (e.g. explicit casting of void* during initialization, maybe it'd be helpful for us to support that?)

@eriksvedang
Copy link
Collaborator

I think this suggestion makes sense. Supporting C++ would definitely be nice, since it's such a common language for useful libraries. Prefixing sounds good.

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