tech-userlevel archive

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

Re: Rationale for some rules in style guide



On Wed, Apr 12, 2023 at 07:40:22PM +0700, Robert Elz wrote:
>   | On Tue, Apr 11, 2023 at 08:30:19PM +0200, Roland Illig wrote:
>   | The style guide says:
>   |    When declaring variables in functions declare them sorted by size
> 
> That one ought be deleted, if only because absolutely no-one follows it
> (properly).   To do that, one would need to fill the declarations with
> #if noise - so that the vars can be placed in proper size order, when
> we don't know for sure what that is until compile time (and it can vary
> depending upon machine arch) - and for arrays, perhaps depending upon
> a size passed in via a header file, or even on the cc command line.
> 
> Absolutely no-one does that - that "rule" should be discarded if only
> for that reason.

Oh I do that for I think its more clear and I didn't even knew it was in the
style guide or I must have read in eons ago :) I also tend to group them by
association. Though agreed, some vars are supposed to be of unknown size so
they might get in the wrong order.

With regards,
Reinoud



Home | Main Index | Thread Index | Old Index