Skip to content

terminology update: use the phrase "detectable illegal behavior" rather than "safety-checked undefined behavior" #2402

@andrewrk

Description

@andrewrk

The language reference makes use of the phrase "safety-checked undefined behavior" to mean "that which is undefined behavior in ReleaseFast and ReleaseSmall modes but will panic in Debug and ReleaseSafe modes".

This is a bit problematic because in the safe build modes, it's actually completely well-defined behavior. It will call the panic handler. Further, it will cause confusion because many people see "undefined behavior" and think it's a weakness of the language, when really it's the opposite - e.g. catching integer overflow bugs wouldn't be possible if it were always defined to be two's complement wraparound arithmetic.

I think a better phrase would be "illegal behavior". Illegal Behavior is always Undefined Behavior in the unsafe build modes. Illegal behavior at compile time is always a compile error. In safe build modes, runtime safety checks attempt to detect illegal behavior, but not all kinds of illegal behavior can be detected. Detected illegal behavior is well-defined and calls the panic handler. Undetected illegal behavior is undefined behavior, even in the safe build modes.

Instead of "safety-checked undefined behavior" the docs would say "detectable illegal behavior".

Related: #1966 #2301

Metadata

Metadata

Assignees

No one assigned

    Labels

    acceptedThis proposal is planned.docsproposalThis issue suggests modifications. If it also has the "accepted" label then it is planned.

    Type

    No type

    Projects

    Status

    To do

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions