Re: Re : Re: Re : Re: Re : Re: [PATCH 06/19] wmaker: Reorganised the header 'funcs.h'

2013-05-19 Thread Rodolfo García Peñas
On Sun, 19 May 2013, Christophe escribió:

 
 - Rodolfo García Peñas (kix) k...@kix.es a écrit :
  Hi
  
  I Am not with my laptop, short answer.
  
  I don't agree because your proposal is include all headers files in
  all source files. We should include only the headers needed.
 
 That is conceptually a nice looking idea, but experience has taught me that 
 it does not scale very well. There are 2 cases which cause problems 
 occasionally:
 
  - headers dependencies: when you're in the middle of working on a larger 
 problem, it is generally annoying to have to hunt down which header you are 
 missing which is causing use of header 'xxx.h' to fail because it needs 
 something defined in another header (read: it distracts you from your main 
 problem, thus increase the risk of error).
 
  - prototype mismatches: for this case, I would invite you to have a look at 
 commit 
 http://repo.or.cz/w/wmaker-crm.git/commit/d517d5cac05a6b0ea905ccf23d79efecb6a0c06e
  and more specifically the case for the 2nd line in the comment; and as an 
 exercise I would invite you to review the patches you proposed and tell me if 
 you notice anything.
 
 The one-header-includes-them-all solution may not seem as conceptually 
 impressive, but pragmatically it has the advantage to gather the header 
 dependency problem in one place, and completely solves 2nd issue by design.
 
Ok,

no problem for me. IMO the compiler will work with a bigger header file, but no 
problem.

The name for the header file? wmaker.h? I don't like too much WindowMaker.h.

Cheers,
kix
-- 
||// //\\// Rodolfo kix Garcia
||\\// //\\ http://www.kix.es/


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


Re : Re: Re : Re: [PATCH 06/19] wmaker: Reorganised the header 'funcs.h'

2013-05-18 Thread Christophe

- 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.


Re: Re : Re: Re : Re: [PATCH 06/19] wmaker: Reorganised the header 'funcs.h'

2013-05-18 Thread Rodolfo García Peñas (kix)

Hi

I Am not with my laptop, short answer.

I don't agree because your proposal is include all headers files in
all source files. We should include only the headers needed.

Cheers
Kix


Quoting Christophe christophe.cu...@free.fr:


- 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.



Rodolfo García Peñas (kix)
http://www.kix.es/


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