----- Carlos R. Mafra <crma...@gmail.com> a écrit :
> On Sun, 12 May 2013 at 13:13:45 +0200, Christophe wrote:
> > 
> > [...]
> 
> I tend to prefer having separate header files matching their .c files.
> It is simpler conceptually.

Sorry for the late answer, have been quite busy again...
Maybe it's a bit late now, as Rodolfo has started the clean-up, but I was 
thinking about a methodology which could be added to the coding style rules:

 - All source files must include only 1 header
    * that does not count system headers
    * the idea is to avoid missing some #include, like it was the case before
    * this header handles in one place the inter-dependency of headers

 - All source file must define their own header, from the moment they share 
more than 3 functions or a struct definition
    * the arbitrary limit of 3 is here to avoid too small file which scatter 
things
    * uses 'WM_<filename_in_uppercase>_H' for include guards
    * defines structs first, then function prototypes (with a comment separator 
between the 2 sections)

 - The common header does this, in *this* order:
    * includes config.h from configure
    * includes system headers that may be needed (types used in headers and 
covers the HAVE_xxx from configure detection)
    * defines anonymous structs that are needed ("typedef struct <name> 
<name>;" without content)
    * includes all the source headers (handles the right order, makes sure 
nothing is missing)
    * defines the prototypes for functions in the case of 3-or-less functions 
from above (with appropriate separator comment with source file name)

This is, of course, open to comments, but it provides a good base to have 
things in a safe, easy-to-work-with state.

Regards,
Christophe.


--
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.

Reply via email to