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]

Re: [PATCH/coding style] clarify pointers and operators

On 12/5/18 3:04 AM, Richard Sandiford wrote:
Thanks for doing this,

Martin Sebor <> writes:
Martin suggested we update the Coding Conventions to describe
the expected style for function declarations with a pointer
return types, and for overloaded operators.  Below is the patch.

As an aside, regarding the space convention in casts: a crude
grep search yields about 10,000 instances of the "(type)x" kinds
of casts in GCC sources and 40,000 of the preferred "(type) x"
style with the space.  That's a consistency of only 80%.  Is
it worth documenting a preference for a convention that's so
inconsistently followed?

Just to be sure, does that grep include things like the go frontend
and its GCC interface, which deliberately don't follow GNU conventions?
A crude grep for me gives 92% consistency in gcc/* itself (excluding
subdirectories), although that's still disappointingly low...

The only thing I excluded was tests.  I don't have the find/grep
script around anymore but I think this should be pretty close:

$ find git-svn/gcc -name "*.[ch]" ! -path "*/testsuite/*" | xargs grep ") [a-zA-Z_0-9]" | wc -l

$ find git-svn/gcc -name "*.[ch]" ! -path "*/testsuite/*" | xargs grep ")[a-zA-Z_0-9]" | wc -l

As I said, it was only a crude search so I'm sure it includes
stuff that's outside the policy (e.g., comments).


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