Better diagnostics for null classes dereferencing

Steven Schveighoffer schveiguy at yahoo.com
Tue Jul 10 20:57:02 UTC 2018


On 7/10/18 4:02 PM, Per Nordlöw wrote:
> On Tuesday, 10 July 2018 at 19:27:07 UTC, Steven Schveighoffer wrote:
>> On 7/10/18 3:01 PM, Per Nordlöw wrote:
>>> Is it possible to change run-time behaviour of null-class 
>>> dereferencing, on Linux, so that it gives some other diagnostics than:
>>>
>>> Program exited with code -11
>>>
>>> Does DMD and LDC provide different alternatives here?
>>
>> Yes, call this function on startup:
>>
>> import etc.linux :  registerMemoryErrorHandler;
>>
>> void main()
>> {
>>     registerMemoryErrorHandler();
>>     ...
>> }
>>
>> No, it's not documented anywhere. Probably should be...
>>
> 
> Okay thanks. When would you not want that behavior to be default?

It was controversial at the time, and considered a hack. It's also only 
supported on Linux. So I don't know the reason why it's not always done 
for Linux, I really think it should be.

-Steve


More information about the Digitalmars-d-learn mailing list