Re: [PATCH] proc_fs.h redux



On Sat, Oct 27, 2007 at 03:40:04PM -0700, Joe Perches wrote:
and forward declarations of

struct proc_dir_entry;
struct file_operations;

As a general rule, I think it better to use includes
than use naked forward declarations.

If you go down that route, you end up with _lots_ of circular
dependencies - header file X needs Y needs Z which needs X. We've
been there, several times. It very quickly becomes quite
unmaintainable - you end up with hard to predict behaviour from
include files.

The only realistic solution is to use forward declarations.

--
Russell King
Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/
maintainer of:
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



Relevant Pages

  • Re: About header files
    ... I put in the header file: all function prototypes with keyword extern ... and the declarations of the structs, which are defined in the main ... struct type definition goes in header ... struct type definition goes in module's .c file ...
    (comp.lang.c)
  • Re: [PATCH] proc_fs.h redux
    ... struct file_operations; ... As a general rule, I think it better to use includes ... dependencies - header file X needs Y needs Z which needs X. We've ... The only realistic solution is to use forward declarations. ...
    (Linux-Kernel)
  • [patch 08/11] [PATCH 08/11] x86: Add AMD specific declarations.
    ... Added AMD specific declarations to header file. ... +struct microcode_header_amd { ... unsigned int sig; ...
    (Linux-Kernel)
  • [patch 6/9] [PATCH 6/9] x86: Add AMD specific declarations.
    ... Added AMD specific declarations to header file. ... +struct microcode_header_amd { ... unsigned int sig; ...
    (Linux-Kernel)
  • Re: null function pointer?
    ... >>> declarations have the same scope and use the same struct tag). ... >>> `f' is a pointer to incomplete type. ... > the type specifiers mean the same type at all points (well, ...
    (comp.lang.c)