Safe mode in D?

Maxim Fomin maxim at maxim-fomin.ru
Sat Oct 19 00:39:35 PDT 2013


On Saturday, 19 October 2013 at 07:12:26 UTC, Max Samukha wrote:
> On Saturday, 19 October 2013 at 07:02:21 UTC, Paulo Pinto wrote:
>> Am 19.10.2013 08:58, schrieb Max Samukha:
>>> On Saturday, 19 October 2013 at 06:24:00 UTC, Paulo Pinto 
>>> wrote:
>>>
>>>>
>>>> There is nothing unsafe about this code snippet.
>>>>
>>>
>>> Sure. There is nothing unsafe in misusing __traits and 
>>> extern(C) as well.
>>
>> There is if the result is
>>
>> - memory corruption
>> - memory leaks no longer visible to the GC
>> - program crash
>> - ...
>
> No problem, since that was the programmer's explicit purpose. 
> C# provides a ton of backdoors that could lead to what you 
> mentioned in your list.

This is wrong. Compare safe D and C# in safe, checked mode (I 
suspect you tried to sell unchecked mode, unmanaged pointers and 
C++ code invocation as unsafe C# - there are also unsafe features 
like casts or unions in unsafe D, but this is irrelevant, we are 
comparing safe mode) and try to come up with examples of memory 
corruption in C#. At least I showed 4 cases of memory corruption, 
4 cases of broken immutable, 2 cases of broken purity in safe D 
without casts, unions and unchekeced attributes of extern C 
(which is also hole in type system). So far, you provided only 
resentment that D was negatively compred with C#.


More information about the Digitalmars-d mailing list