Why dont dlang check NullPointer?
Shammah Chancellor via Digitalmars-d
digitalmars-d at puremagic.com
Fri Mar 27 07:39:36 PDT 2015
On 2015-03-27 05:34:59 +0000, zhmt said:
> On Friday, 27 March 2015 at 04:13:01 UTC, deadalnix wrote:
>> On Friday, 27 March 2015 at 03:59:30 UTC, zhmt wrote:
>>>>
>>>> The best way to do that is to separate the server modules into
>>>> independent processes. Then if one crashes, the others keep running
>>>> without fear of corruption.
>>>>
>>>> So instead of server modules, try doing mini servers that communicate
>>>> with the main server. This is how a lot of newer programs are written
>>>> because of the reliability and security benefits it offers.
>>>
>>> But this will make the developement more difficult for me, or not acceptable.
>>>
>>> Is there any other ways?
>>
>> http://www.deadalnix.me/2012/03/24/get-an-exception-from-a-segfault-on-linux-x86-and-x86_64-using-some-black-magic/
>>
>>
>> There is a hook in the runtime to enable this if you want.
>>
>> BUT, null pointer exception or not, Adam is right. Have your stuff run
>> in multiple process that you can restart. This is more reliable, this
>> is more secure, this is easier to update without downtime, and so on...
>> This is far superior solution for server stuff.
>
> multi-process means crashes are isolated by process, but isolated by
> thread may be more handy.
>
> For example , this feature is suported by java c# lua, ie.
>
> This can make dlang app developed by most developers more reliable.
All the languages you mention run in a VM. In the case of a systems
language like D, the operation system itself is intercepting the
reference to invalid memory and sending a SIGSEG to the process. The
default handler causes the process to immediately terminate. Having
the D runtime do something different in the SIGSEG handler by default
would be bad form.
-Shammah
More information about the Digitalmars-d
mailing list