Hi Chris, On 4/9/16 11:41 AM, Christopher Collins wrote:
I know of no other way, aside from using a script to put those guards on all the headers. Note however that they only need to go on the public include headers (include/), not the private headers in the src directories.
Yup, although this should probably just go in the coding standards/standard header file framework. I don't see there being a reason to keep these two different, except for a saving a little bit of work now.
There is one other possibility. I don't think it is what you're asking about, but I thought it was worth mentioning for completeness. If the mynewt libraries were reduced to the subset of C and C++ (some people call this "Clean C"), then everything could be built with a C++ toolchain. In this case, there would be no need for the extern "C" guards. I don't particularly care for this solution personally, as there are a few annoying differences between the languages (one of the biggest being that C++ does not support the implicit conversion to and from void*).
Nah. We're writing this in C, and especially when it gets to mixed C/assembly, lower layer C, I'm not sure all the contortions make sense. We can just '#ifdef __cplusplus.'
Sterling
