Signed word lengths and indexes
BCS
none at anon.com
Tue Jun 15 13:07:26 PDT 2010
Hello Steven,
> On Tue, 15 Jun 2010 11:47:34 -0400, BCS <none at anon.com> wrote:
>
>> Hello Steven,
>>
>>> This is easily solved - put in a comment. I frequently put comments
>>> in my code because I know I'm going to forget why I did something.
>>>
>> All else being equal, code that *requiters* comments to understand is
>> inferior to code that doesn't.
>>
> Code should *always* have comments. I hate reading code that doesn't
> have comments, it allows you to understand what the person is
> thinking.
I agree. It should have comments. But if stripping them out would render
the code unmaintainable, that indicates to me that it's likely the code is
to complex. It's a sliding scale, the more difference the comments make,
the more of an issue it is. And again, this is an "all else being equal"
case; given two option and nothing else to chose between them, I'll pick
the one that needs fewer comments.
>>> Reading code assuming integer wrapping never occurs is a big
>>> mistake. You should learn to assume wrapping is always possible.
>>>
>> You should learn to write code where I and everyone else doesn't
>> /need/ to assume it is possible.
>>
> Why? If you can't understand/spot overflow/underflow problems, then
> why should I cater to you? It's like lowering academic testing
> standards for school children so they can pass on to the next grade.
The way peoples brains are wired, the first thought people will have about
that code is wrong. If that can be avoided, why not avoid it?
>
>> (personably, I find it marginally offensive/greedy when someone's
>> first proposal as to how to fix a problem if for the rest of the
>> world to change and the second option is for the person to change.)
>>
> Why is it offensive if I expect a code reviewer to take overflow into
> consideration when reviewing code
That's /not/ offensive. For one thing, only very few people will ever need
to be involved in that. The reason I wouldn't let it pass code review has
zero to do with me not understanding it (I do understand for one thing) but
has 100% with anyone who ever needs to touch the code needing to understand
it. That is an open set (and that is why I find it marginally offensive).
The cost of putting something in your code that is harder (note I'm not saying
"hard") to understand goes up the more successful the code is and is effectively
unbounded.
> It's not some sort of snobbery, I
> just expect reviewers to be competent.
I expect that to. I also expect people reading my code (for review or what-not)
to have better things to do with their time than figure out clever code.
--
... <IXOYE><
More information about the Digitalmars-d
mailing list