Skip to content

Commit bbf1031

Browse files
authored
Merge pull request #2209 from WalterBright/DebugStatement
Clarify behavior of debug statements merged-on-behalf-of: Mike Franklin <JinShil@users.noreply.github.com>
2 parents 83253f6 + 4278f87 commit bbf1031

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

spec/version.dd

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,8 +422,25 @@ debug:
422422
}
423423
------
424424

425+
$(H3 $(LNAME2 DebugStatement, Debug Statement))
425426

426-
$(H3 $(LNAME2 debug_specification, Debug Specification))
427+
$(P A $(GLINK ConditionalStatement) that has a $(GLINK DebugCondition) is called
428+
a $(I DebugStatement). $(I DebugStatements) have relaxed semantic checks in that
429+
`pure`, `@nogc`, `nothrow` and `@safe` checks are not done.
430+
Neither do $(I DebugStatements) influence the inference of `pure`, `@nogc`, `nothrow`
431+
and `@safe` attributes.)
432+
433+
$(UNDEFINED_BEHAVIOR Since these checks are bypassed, it is up to the programmer
434+
to ensure the code is correct. For example, throwing an exception in a `nothrow`
435+
function is undefined behavior.
436+
)
437+
438+
$(BEST_PRACTICE This enables the easy insertion of code to provide debugging help,
439+
by bypassing the otherwise stringent attribute checks.
440+
Never ship release code that has $(I DebugStatements) enabled.
441+
)
442+
443+
$(H2 $(LNAME2 debug_specification, Debug Specification))
427444

428445
$(GRAMMAR
429446
$(GNAME DebugSpecification):

0 commit comments

Comments
 (0)