This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Forward declaration style


Hi all,

I was always wondering why this the way it is.  E.g. consider
gcc/output.h:

/* Assemble the integer constant X into an object of SIZE bytes.  ALIGN is
   the alignment of the integer in bits.  Return 1 if we were able to output
   the constant, otherwise 0.  If FORCE is nonzero the constant must
   be outputable. */
extern bool assemble_integer (rtx, unsigned, unsigned, int);

Here the function abstract mentions some argument names which are absent
in the declaration.  When reading/browsing/searching the GCC code base
this is really not helpful.  One is forced to go to the implementation
of the function and read it.  On top of that the actual function
implementations are often in totally different places (e.g. there is no
such thing as output.c).
In lots of other cases, the declarations in the headers don't have any
documentation at all.  In the assemble_integer case it's duplicated in
output.h and varasm.c.

How about adding the argument names to the declarations in header files
and move function abstracts from implementation files to the header
files?  I think this would make it easier to lookup stuff in the code.
What do you think?

Cheers,
Oleg



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]