forked from dlang/dlang.org
-
Notifications
You must be signed in to change notification settings - Fork 0
/
memory-safe-d.dd
59 lines (45 loc) · 1.31 KB
/
memory-safe-d.dd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
Ddoc
$(SPEC_S The Memory Safe D Spec,
$(P $(I Memory Safety) for a program is defined as it being
impossible for the program to corrupt memory.
Therefore, the Safe D consists only of programming language
features that are guaranteed to never result in memory
corruption.
)
$(P Safe D is enabled on a per-module basis by compiling with
the $(B -safe) compiler switch.
)
<h3>Proscribed Forms</h3>
$(UL
$(LI $(LINK2 iasm.html, Inline assembler).
)
$(LI Casting away const or immutable attributes.
)
$(LI Casting away shared attributes.
)
$(LI Casting from one pointer type to another pointer type,
except for:
$(UL
$(LI casting to $(CODE void*) is allowed)
$(LI casting from a pointer to an arithmetic type to
a pointer to another arithmetic type of the same or
smaller size is allowed)
)
)
$(LI Casting from a non-pointer type to a pointer type.
)
)
$(P A safe module can import and use the public interface of
a system module.
)
<h3>Limitations</h3>
$(P Safe D does not imply that code is portable, uses only
sound programming practices, is free of byte order dependencies,
or other bugs. It is focussed only on eliminating memory corruption
possibilities.
)
)
Macros:
TITLE=Memory-Safe-D-Spec
WIKI=SafeDSpec
CATEGORY_SPEC=$0