Bruno Haible via GNU coreutils General Discussion <[email protected]>
writes:

> The source code src/date.c is written mostly bottom-up, a style which does
> not need forward declarations. Here's a patch to make it entirely bottom-up,
> removing the last needed forward declarations.

Yep, looks good in this simple case.

> NB: I'm not saying that bottom-up style is "better" or should be _generally_
> preferred to the top-down style. Each has its own benefits. Only that
> having an 80% bottom-up style with a helper function at the end (20%
> top-down style) makes the code hard to understand.

Yep, before working on GNU software I would always write 'main' at the
top with prototypes preceding. Then all of the function definitions
below 'main'. In Coreutils, src/pr.c is similar to this style.

But most of the programs in Coreutils and Gnulib test suite have 'main'
at the bottom and avoid the need forward declarations. This has grown on
me.

Ideally, all the programs would be consistent. But it is not worth
making the 'git blame' harder to go through.

Collin

  • PATCH: date: Refactor Bruno Haible via GNU coreutils General Discussion
    • Re: PATCH: date: Re... Collin Funk

Reply via email to