Re: Namespacing of Zephyr headers and API


Paul Sokolovsky
 

Hello Tomasz,

On Mon, 3 Apr 2017 11:37:18 +0200
Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com> wrote:

Hi Paul,


Hello,

This matter already came up in patch reviews and during BSD Sockets
discussion, and I think it's worth to have a dedicated discussion on
it. So, currently there're 2 problems:

1. Zephyr header files aren't namespaced in any special matter, and
may conflict with headers of 3rd-party components with which a
Zephyr application may integrate.
It could be solved by having 'include/zephyr' as a directory where to
find zephyr's specific headers
#include <zephyr/...> is imo preferable than having a prefix on all
zephyr headers.
Yes, sure, that's what I meant too, a directory prefix, not a filename
prefix, sorry if it sounded like that.


2. About the same is true for Zephyr API calls either. At least
there subsystem prefixes, like "net_" for network subsys, "sensor_"
for sensor subsys. But there're still no namespacing for Zephyr API
as a whole.
What do you mean as a whole? Like same unique prefix for all
subsystems?
Yes, like each and every Zephyr function to start with a common string
prefix. But as I mentioned, I couldn't think of a perfect prefix
myself. E.g. "zephyr_" is too long, "z_" is perhaps too short and
unclear (I wonder what ZFS uses as a prefix for example). "zep_" might
be the right length, but maybe not the best abbreviation (well, we use
it in Jira, but that's Jira ;-) ).



Tomasz

--
Best Regards,
Paul

Linaro.org | Open source software for ARM SoCs
Follow Linaro: http://www.facebook.com/pages/Linaro
http://twitter.com/#!/linaroorg - http://www.linaro.org/linaro-blog

Join devel@lists.zephyrproject.org to automatically receive all group messages.