瀏覽代碼

Supplemented docs

Taddeus Kroes 12 年之前
父節點
當前提交
632c12d380
共有 1 個文件被更改,包括 24 次插入0 次删除
  1. 24 0
      phases/unroll.mli

+ 24 - 0
phases/unroll.mli

@@ -52,6 +52,30 @@
 
     A simple heuristic is applied to decide whether a recognised for-loop will
     be unrolled: the resulting number of statements must not be larger than 20.
+
+    Note that since programmer-defined for-loops are also transformed into
+    while-loops, these are recognized by the compiler as well (as long as the
+    loop has constant boundaries). For example:
+
+{v extern void printInt(int val);
+export int main() \{
+    for (int i = 0, 10, 2)
+        printInt(i);
+
+    return 0;
+\} v}
+
+    which is transformed into:
+
+{v extern void printInt(int val);
+export int main() \{
+    printInt(0);
+    printInt(2);
+    printInt(4);
+    printInt(6);
+    printInt(8);
+    return 0;
+\} v}
     *)
 
 (** Main phase function, called by {!Main}. *)