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



    Date:        Thu, 13 Apr 2023 17:45:54 +0200
    From:        Reinoud Zandijk <reinoud%NetBSD.org@localhost>
    Message-ID:  <ZDgjsqgtb87NOO8H%gorilla.13thmonkey.org@localhost>

  | So not so strict no

Not strict, not even very close I suspect - but nor is anyone else.
Even those who think they're following the style guide (for this)
aren't (in general - they may sometimes for one particular target
architecture, or even occasionally a class of them).

But more, nor is there any reason reason to, even when you think
you have done it perfectly, the compiler goes and drops some of the
vars, as it can generate code using only registers for them, and needs
no memory allocated - and all the planning to get things to work
perfectly is undone.

  | and I generally avoid putting structs on the stack as in

struct != big ... some structs are smaller than pointers (dynamically
allocating them and keeping a pointer can actually waste space).

  | kernel code stacks can get tight far too easily.

Even though we call it KNF, the style guide applies just as much to
userland code.


Roland - go ahead and nuke that entry from the style guide, it is
pointless.

kre



Home | Main Index | Thread Index | Old Index