Bad array indexing is considered deadly
Steven Schveighoffer via Digitalmars-d
digitalmars-d at puremagic.com
Wed May 31 06:46:56 PDT 2017
On 5/31/17 9:37 AM, Adam D. Ruppe wrote:
> On Wednesday, 31 May 2017 at 13:04:52 UTC, Steven Schveighoffer wrote:
>> What are your thoughts? Have you run into this? If so, how did you
>> solve it?
>
> I don't use vibe, but my cgi.d just catches RangeError, kills the
> individual connection, and lets the others carry on. Can you do the same
> thing?
There are a couple issues with this. At least from the perspective of
vibe.d attempting to be a mainstream base library.
1. You can mark a function nothrow that throws a RangeError. So the
compiler is free to assume the function won't throw and build faster
code that won't properly clean up if an Error is thrown.
2. Technically, there is no guarantee by the runtime to unwind the
stack. So at some point, your workaround may not even work. And even if
it does, things like RAII may not work.
-Steve
More information about the Digitalmars-d
mailing list