tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: style: clean up mentions of old-style C



Am 17.04.2023 um 02:55 schrieb David Holland:
On Sat, Apr 15, 2023 at 11:47:08AM +0200, Roland Illig wrote:
  > Since C90, function prototypes are available. They have become so common
  > now that mentioning them is more confusing than helpful. I suggest
  > removing these two lines:
  >
  > >  * Use ANSI function declarations.  ANSI function braces look like
  > >  * old-style (K&R) function braces.
  >
  > I don't know what 'ANSI function braces' are or how they might differ
  > from 'old-style function braces'. What is the point of this sentence,
  > and why is it needed?

How about (given what people have said about the sentence):

   * Use full function prototypes in all declarations and definitions.
   * The open-brace for a function body goes on its own line.

The second point is an important part of the traditional layout, and I
think the first is still worth stating. You _still_ see K&R-style
code, 35-odd years notwithstanding.

I don't see the need to spell out the first point at all, as GCC already
complains about any missing '(void)' in function types when WARNS is set
to 1 or more.

Roland



Home | Main Index | Thread Index | Old Index