On Wednesday, 15 February 2017 at 19:56:31 UTC, berni wrote:
On Wednesday, 15 February 2017 at 16:11:36 UTC, drug wrote:
No, you recursively call main() and get segfault (due to stack overflow) as expected

I thought, that an stack overflow leeds to an exception. But that's not true, as I now see. Thanks for your answer.

That's a language implementation and may not be true in *all* languages.

Theoretically a stackoverflow cannot be a thrown exception (Even in languages where it appears so such as c#), because it would require space in the stack, which obviously you just overflowed, so there's none.

That's why exceptions such as that would be reallocated at runtime before program start, but that may not be the case for all languages. I'm not sure what D does, but it seems like it does nothing, hence why there's no exception for it and you just end up with a segfault. Also remember that D is a system's programming language, so things like that may not be optimal in all environments and all operating systems.
  • A bug? berni via Digitalmars-d-learn
    • Re: A bug? drug via Digitalmars-d-learn
      • Re: A bug? berni via Digitalmars-d-learn
        • Re: A bug? bauss via Digitalmars-d-learn

Reply via email to