View Single Post
Old July 5, 2019, 23:38   #88
Nick
Vanilla maintainer
 
Nick's Avatar
 
Join Date: Apr 2007
Location: Canberra, Australia
Age: 54
Posts: 7,773
Donated: $60
Nick is on a distinguished road
Quote:
Originally Posted by takkaria View Post
I guess these days it matters less to me because I tend to write shorter functions than I used to, but in the past I found that putting definitions not at the top of functions was useful for figuring out what was used when. I think Angband is particularly bad in some of its older code for this. You have a 3 page long function with variable names like 'seen' and 'flag' which are defined at the top of a function and used twice somewhere in the middle. It's really difficult to understand what is going on.
I tend to be with takkaria on this one (not least because most of the C I write is for Angband). I also agree about the length of the functions, with calc_bonuses() and some of the object handling and targeting functions being among the big offenders.

All that said, my comment to PowerWyrm was mainly to encourage the continued finding of bugs in V code. I'm not sure if anyone else has noticed, but the 4.x.y releases where y > 0 are usually heavily loaded with bugfixes provided by PowerWyrm while implementing 4.x.y-1 features into PWMAngband
__________________
One for the Dark Lord on his dark throne
In the Land of Mordor where the Shadows lie.
Nick is offline   Reply With Quote