Declarations and Definitions in One Header

From: Steven T. Hatton (susudata_at_setidava.kushan.aa)
Date: 04/25/04


Date: Sat, 24 Apr 2004 19:56:09 -0400

Now why didn't *_I_* think of that!

Declarations and Definitions in One Header

C++ object definitions can be quite complex. In principle, your source code
will need two kinds of things for each object that you use across more than
one source file. First, you need an interface specification, describing its
structure with type declarations and function prototypes. Second, you need
the implementation itself. It can be tedious to maintain a separate
interface description in a header file, in parallel to the actual
implementation. It is also dangerous, since separate interface and
implementation definitions may not remain parallel.

http://tinyurl.com/2xx3w

-- 
STH 
Hatton's Law: "There is only One inviolable Law"
KDevelop: http://www.kdevelop.org  SuSE: http://www.suse.com
Mozilla: http://www.mozilla.org


Relevant Pages

  • Re: managing header files
    ... The chances that every source file needs every other source file's header is approximately nil. ... When a system gets to hundreds of source files, this can reduce the compilation time significantly because the compiler reads fewer files. ... while in the .h files the external declarations showed no arguments. ...
    (comp.lang.c.moderated)
  • Re: Thoughts on file organisation
    ... on stdlib.h for its declarations, ... recommend not to use header guards. ... functions, one for I/O, and none for system calls. ... the files in /sys/include correspond to libraries. ...
    (comp.lang.c)
  • Re: Unexpected errors in C compilation
    ... functions in a C source should be declared in a header file. ... the external functions. ... forward declarations of all local functions. ... The global data declarations and definitions go in there somewhere too, ...
    (comp.sys.acorn.programmer)
  • Re: Design orientated C question
    ... C++) definitions and function declarations. ... So isn't this structure definition allowed in my header? ... "Every .cpp file that uses structure/class definitions or function ... have everthing it needs to access any member of a structure within the array ...
    (microsoft.public.vc.language)
  • Re: inline trouble with -std=gnu99 (gcc)
    ... "Eric Sosman" wrote: ... type in just one header, and #include that unique header wherever ... contain things that "use" function declarations. ... for making mistakes will pay off. ...
    (comp.lang.c)