DIP 1028---Make @safe the Default---Community Review Round 1

Ola Fosheim Grøstad ola.fosheim.grostad at gmail.com
Tue Jan 7 10:25:36 UTC 2020


On Tuesday, 7 January 2020 at 10:01:29 UTC, Max Samukha wrote:
> I don't think there is such thing as "industry accepted 
> convention" with regard to "unsafe".


It is standard terminology for program semantics going unchecked 
both statically and dynamically.

"unsafe" does not say that the written code is doing anything 
wrong. "unsafe" means that the compiler isn't doing what is 
expected from a proper high level language in terms of catching 
illegal constructs.

A language defines a set of text strings that is considered legal 
(valid) code. In a well specced language all legal code is safe.

Most compilers fail to catch all illegal constructs and will emit 
code for programs that does not belong to the defined language. A 
decent (safe) language will then emit runtime checks that will 
catch such programs at runtime and stop them (e.g. indexes out of 
bounds).

However, in an unsafe language, or unsafe language mode, or 
unsafe language constructs, the compiler and runtime will not 
detect and stop programs that don't belong to the defined 
language.

That is the meaning of "unsafe".



More information about the Digitalmars-d mailing list