unsafe blocks
Closed this issue · 1 comments
Mesabloo commented
As seen in #2 (comment), we will need to have some sort of unsafe
blocks to encapsulate potential undefined behaviors, like pointer offsets or address dereferencing (the compiler can't determine that the address actually points to something valid).
Unsafe blocks would have a similar syntax to
# instructions
unsafe {
# instructions
}
# instructions
where it encloses unsafe operations as described above. The compiler could also detect whether an instruction is really unsafe, or not, and probably throw a warning back, something like "This instruction be potentially not be unsafe. You could remove it from the enclosing unsafe block."
Mesabloo commented
Also, instead of having to put a complete block for one single instruction, we could allow this:
unsafe <instruction>
which would act the same as
unsafe {
<instruction>
}
or
unsafe { <instruction> }