A Philosophy of Software Design
Meta
jared771 at gmail.com
Mon May 25 19:39:23 UTC 2026
On Monday, 25 May 2026 at 17:26:59 UTC, Walter Bright wrote:
> I forgot to mention - an out of memory error is nearly always a
> fatal error for a program. There's no reason one couldn't, when
> failing to enlarge the string buffer:
> ```
> char* buffer = cast(char*)malloc(newsize);
> if (!buffer)
> fatal_error("string too big for memory!");
> ```
Ah yes, okay, that's at least better than a cryptic "out of
memory" error.
> And another problem with exceptions are the "double fault"
> ones, where an exception is thrown from within an exception.
> That's a fatal error.
True, although most software I've worked on was written almost
entirely in Java, with supplementary pieces on Python, Perl, Go,
Lua, Bash, etc. I think these type of "double fault" exceptions
are mostly a problem in C++, because the way it does exceptions
is so convoluted. Most "managed" languages do it differently, and
IMO better. Java for example uses a similar "chaining" mechanism
to D, which I've used heavily in a lot of code I've written.
More information about the Digitalmars-d
mailing list