aboutsummaryrefslogtreecommitdiffhomepage
path: root/notes/global_const_data.txt
blob: 9d9b3047416fe5e9452a4c16c317ff92cd4a6398 (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

Global const data
=================

SLUL will not have global mutable data.
But it will have global constant data (e.g. a constant array of bytes).

Requirements for globals:
1. Must be constant/immutable.
2. Must be compile-time constants / Cannot have initializers.
3. Must not be (or contain) references
   (that would require initializers / would not be compile-time constant)
4. Must be architecture-independent
   (otherwise it can overflow or create an invalid array index on
    some platforms, but not on other).

Problems:

"wuint i = large_number + 1"
"int i = large_number + 1"
    - this gives different behavior depending on the size of int.
    - requiring int = 32 bits is probably a very good idea anyway,
      except for embedded platforms.
    => forbid wuint in const-exprs if "\option allow16" is in enabled?