This is the mail archive of the 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]

Prototypes [was Re: Patch for bugs 772 and 17913]

On Tue, 3 May 2005, [ISO-8859-2] Gábor Lóki wrote:
> >>+static tree contains_label_1 (tree*, int*, void*);
> >>+static bool contains_label_p (tree);
> >
> > You only need to prototype the constains_label_p call, as it's
> > subroutine contains_label_1 is only used after it's defined.
> > If both these routines were moved earlier in fold-const.c, you
> > wouldn't need to prototype either.
> Of course, the prototype of 'contains_label_1' isn't necessary.
> Personally, I prefer using prototypes in this way, but I can remove it.

Richard Henderson recently stated his position on this issue in

	You'll say its needed for this decl, but this decl isn't needed
	due to function ordering.  Indeed, I make it a habit not to
	pre-declare anything unless forced.  I prefer functions to
	simply be ordered such that the decls aren't needed.

Whilst, to my knowledge, no official position has yet been taken on the
preferred GCC style, RTH's position eliminates the arbitraryness with
GCC's current style.  There are currently both lots of prototypes that
aren't strictly needed, and lots of functions without prototypes.  A
decision to minimize prototypes (and prefer function ordering) also has
maintenance benefits, as we probably still have many prototypes for
functions that have long since been deleted, and theoretically even
unconditional prototypes that don't match conditionally compiled
function declarations.

Perhaps the discussion should be opened to wider debate, ratified
and then documented in ?
Admittedly, this document is some what out of date, as it doesn't
describe GCC's decision to move to C89/C90 and the default authority still recommends
using K&R style function declarations and PARAMS-like macros in
function prototypes, which have recently been abandoned by the GCC


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