On Mon 06 Nov 2017 01:36:01 PM CET, Max Reitz wrote:
>>>>> -        assert(offset);
>>>>
>>>> I don't think this assert() was meant as a protection against offset
>>>> being 0. :-)
>>>
>>> After the new check offset is now guaranteed to be 0, so what's the
>>> point of keeping the assert() ?
>> 
>> I meant "guaranteed _not_ to be 0" :-)
>
> That is the point of an assert.
>
> An assert should not guard against something that can occur. It should
> express that something will always be true (in this case that the
> offset is guaranteed not to be 0).

Right, and they're especially useful when it's not obvious that the
assertion is always true.

The reason why I removed the assertion in this case is that the code
that checks and guarantees that the offset is not null is immediately
before the assert() line.

But I'm not going to argue over something like this, I don't mind if you
prefer to keep it :-)

Berto

Reply via email to