blob: 5601e7907e87f6ca700f904c50761960594e8937 (
plain)
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
|
Variable initialization
-----------------------
undefined
---------
The value of these variables is the undefined value. The exact behaviour
depends on the compiler options. There are three possibilities:
* compile-time error (if possible to detect)
* run-time error (unless disabled)
* the variables get arbitrary values.
int i;
int#[4] i;
int^ i;
initialized
-----------
These variables are initialized. In this case they are zero, so they will
be placed in the "zero-initialized data" section in the final executable
file (unless they are on the stack, then they are simply assigned their
value).
int i = 0;
int#[4] i = [0,0,0,0];
int^ i = none;
default
-------
Initialization with default values:
int i = _;
int#[4] i = _;
int^ i = _;
This works on all types that have the "defval()" function in their namespace:
namespace int {
() defval(int ^value) {
value^ = 0;
}
}
// What about array types, pointers, optional types, etc?
|