Tuesday, August 31, 2021

Re: nit-picking knf question

On 8/31/21 10:22 PM, Leon Fischer wrote:
>> From: gwes <gwes@oat.com>
>> Date: Tue, 31 Aug 2021 19:47:28 -0400
>>
>> Where to declare local variables used in a small subordinate scope?
>> Specifically at the top of a routine or at the beginning of the
>> context where they're used?
>> I don't see it in style(9)
> style(9) used to advise against it, but now it's been removed.
> More discussion: https://marc.info/?l=openbsd-tech&m=158063913531253&w=2
Thanks for the pointer! Both sides have good points.
I like locals declared where used whenever reasonably possible.

Even really good compilers can get tired trying to optimize 1000 line
functions.
Liveness tracking breaks down. Keeping variables local can make
everyone's job easier.

Agreed: verifying cleaned up code is exhausting.

thanks again!
geoff steckel

No comments:

Post a Comment