OSNews article about C++09 degenerates into C++ vs. D discussion

Benji Smith dlanguage at benjismith.net
Mon Nov 27 11:59:45 PST 2006


Don Clugston wrote:
> I think it's even worse than that. The opposite of 'unsafe' is *not* safe!
> 
> My brother has worked with medical software which contain software bugs 
> which kill people. And the bugs are NOT 'dangling pointers', they are 
> incorrect mathematics (wrong dosage, etc). The code is 'safe', yet 
> people have been taken out in body bags.
> 
> I think this whole "safe"/"unsafe" concept can be distracting -- the 
> goal is software with no bugs! It's just a tool to reduce a specific 
> class of bugs. D does many features which help to reduce bugs, the 
> concept of 'safe' code just isn't one of them.

I actually like the "unsafe" keyword in C# (never used C++.NET).

The words "safe" and "unsafe" refer only to type-safety, so it would be 
more accurate (but cumbersome) if the keyword was "untypesafe" to 
indicate blocks of code circumventing the type system.

It's nice to know that the default assumption in C# is that nearly all 
code will subject itself to the compiler's static type checking. Sure, 
sometimes it's necessary circumvent the type system by casting pointers, 
but I think it helps enforce good programming practice that those 
untypesafe operations have to be specifically annotated before the 
compiler will accept them.

--benji



More information about the Digitalmars-d mailing list