[riot-devel] Location of header files

Martin Lenders authmillenon at gmail.com
Thu Jun 20 13:32:35 CEST 2013


Hi,

2013/6/20 Oleg Hahm <oliver.hahm at inria.fr>

> This situation is clearly poor and unsatisfying. Additionally, it raises
> the
> question about how to include the headers into C files. Should each
> application add every single include path to its Makefile and then just
> put a
>   include "foobar.h"
> into the source code or is it "better" to include relative paths like
>   include "sys/foo/foobar.h"
>

I would prefer to add the module's include path in its Makefile, so you can
just write "#include <foobar.h>"


> I really think we should tidy up this mess once and for all. So, what do
> you
> prefer? Put all headers into a generic path (like *nix system do)?
> Something
> like RIOT/include/. Or enforce the policy to store headers closely to the
> corresponding C files? And if so, would you prefer separate include
> directories or mingle source and header files?
>
> Personally, I would vote to locate header files into an include
> subdirectory
> of the corresponding module. In my opinion, this is the cleanest solution
> and
> obeys RIOT's modularity best. I would then configure the Make system in a
> way,
> that include paths are set accordingly to the used modules in the
> application's Makefile. Whaddayathink?
>

Yes, but this might cause some naming collisions, given the fact each
module would include its include directory to the global include path. I
would propose that we do the following scheme

include/<modulename>.h  // optional, if it makes sense: includes all
headers in include/<modulename>/

and

include/<modulename>/<subheaders…>

Cheers,
Martin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/devel/attachments/20130620/824937d4/attachment.html>


More information about the devel mailing list