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
bool
checkUnsafeAccess
(Scope*sc
, Expressione
, boolreadonly
, boolprintmsg
);Check for unsafe access in @safe code:
- read overlapped pointers
- write misaligned pointers
- write overlapped storage classes
Parameters
Scope*
sc
scope
Expression
e
expression to check
bool
readonly
if access is read-only
bool
printmsg
print error message if
true
Return Value
true
if error -
Declaration
bool
isSafeCast
(Expressione
, Typetfrom
, Typetto
);Determine if it is @safe to cast
e
fromtfrom
totto
.Parameters
Expression
e
expression to be cast
Type
tfrom
type of
e
Type
tto
type to cast
e
toReturn Value
true
if @safe -
Declaration
bool
checkUnsafeDotExp
(Scope*sc
, Expressione
, Identifierid
, intflag
);Check for unsafe use of
.ptr
or.funcptr
Parameters
Scope*
sc
context
Expression
e
expression for error messages
Identifier
id
ptr
orfuncptr
int
flag
DotExpFlag
Return Value
true
if error