dmd.safe
Checks whether member access or array casting is allowed in @ code.
safe
Specification: Function Safety
License
Source: safe.d
Documentation: https://dlang.org/phobos/dmd_safe.html
-
Declaration
boolcheckUnsafeAccess(Scope*sc, Expressione, boolreadonly, boolprintmsg);Check for unsafe access in @safe code:
- read overlapped pointers
- write misaligned pointers
- write overlapped storage classes
Parameters
Scope*scscope
Expressioneexpression to check
boolreadonlyif access is read-only
boolprintmsgprint error message if
trueReturn Value
trueif error -
Declaration
boolisSafeCast(Expressione, Typetfrom, Typetto);Determine if it is @safe to cast
efromtfromtotto.Parameters
Expressioneexpression to be cast
Typetfromtype of
eTypettotype to cast
etoReturn Value
trueif @safe -
Declaration
boolcheckUnsafeDotExp(Scope*sc, Expressione, Identifierid, intflag);Check for unsafe use of
.ptror.funcptrParameters
Scope*sccontext
Expressioneexpression for error messages
IdentifieridptrorfuncptrintflagDotExpFlag
Return Value
trueif error