diff --git a/index.html b/index.html index 3c4cefa..23d267b 100644 --- a/index.html +++ b/index.html @@ -204,10 +204,8 @@ llOwnerSay("Program version " STRINGIFY(VERSION)
The syntax of the switch
statement as implemented, has two restrictions over its C counterpart:
case
labels can't appear in nested blocks. That's because they are replaced by LSL labels, and as discussed in the Multiple labels with the same name section above, label scope rules prevent their visibility in an outer block, so once converted to labels, the corresponding jump
instructions would not be able to find them. This limitation means that Duff's device or similar constructs can't be implemented with this optimizer.switch() needs to be followed by a block, not by a single statement. For example, whiile this works in C, it won't work in this optimizer:
+case
labels can't appear in nested blocks. That's because they are replaced by LSL labels, and as discussed in the Multiple labels with the same name section above, label scope rules prevent their visibility in an outer block, so once converted to labels, the corresponding jump
instructions would not be able to find them. This limitation means that Duff's device or similar constructs can't be implemented with this optimizer.
+switch()
needs to be followed by a block, not by a single statement. For example, whiile this works in C, it won't work in this optimizer:
switch(1) case 1: break;
The reason is that case
is treated by this parser as a statement, rather than as a label prefix, making break
be outside the switch
. This limitation is probably only of theoretical importance and will not have any practical implication, since single-statement switch
clauses are of little no practical use (known to the author). Of course it works perfectly when enclosed in braces:
switch(1) { case 1: break; }