mozilla / cbindgen

A project for generating C bindings from Rust code
Mozilla Public License 2.0
2.43k stars 314 forks source link

Default cpp_compat to true #996

Closed Sainan closed 3 weeks ago

Sainan commented 3 months ago

I think there's no reason not to do this, since otherwise it's either extra work for maintainers of the Rust projects (by either creating separate C++ headers, or by creating a TOML file just to set this config), or for C++ users to wrap extern "C" around the #include.

This approach of ifdef'ing __cplusplus is used even in Lua, which is compatible with C89, so I think it's absolutely fine to generate this code, and I wouldn't expect any breakage.