Bad array indexing is considered deadly
Nick Sabalausky (Abscissa) via Digitalmars-d
digitalmars-d at puremagic.com
Wed May 31 13:09:16 PDT 2017
On 05/31/2017 02:55 PM, Moritz Maxeiner wrote:
> On Wednesday, 31 May 2017 at 17:13:08 UTC, Nick Sabalausky (Abscissa)
> wrote:
>> On 05/31/2017 09:04 AM, Steven Schveighoffer wrote:
>>>
>>> What are your thoughts?
>>
>> +1 million. I *hate* D's notion of Error. Well, no...more correctly, I
>> absolutely hate that it throws cleanup/unwinding straight out the
>> window for many situations that can obviously be handled safely
>> without the paranoid "ZOMG Sky Is Falling!!!!" overreaction that is
>> baked into the design of Error. And that causes problems like the one
>> you describe.
>
> To be fair, anything that can be handled in a sane&safe way should
> inherit from Exception, not from Error, so throwing away cleanup for
> Error makes sense, since an Error means the program is in an undefined
> state and should terminate asap.
Then out-of-bounds and assert failures should be Exception not Error.
Frankly, even out-of-memory, arguably. And then there's null
dereference... In other words, basically everything.
More information about the Digitalmars-d
mailing list