Changes between Version 31 and Version 32 of IR2


Ignore:
Timestamp:
04/28/21 14:49:00 (5 years ago)
Author:
siegel
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • IR2

    v31 v32  
    66
    77=== Questions ===
    8 * How is an array allocated?   An array variable `a` is declared with a decl such as `T a[];`, and then a statement such as `a=$new(T[n]);` will assign to a new arbitrary array value for an array of length `n` of elements of type `T`.    For heap-allocation, a pointer is declared with a decl such as `T * p`, and a heap variable is also declared somewhere with a decl such as `$heap heap;` and then a statement such as `p = $alloc(&heap, n, T);`; it can be deallocated with `$free(p);`.
    9 * how to initialize a variable (what are initial values?)
     8
     9Do variables have initial values?:: No, a declared variable must be initialized before it is used.
     10How do you initialize a variable?::  By assigning a value to it.   For example `n=$new($int);` will assign `n` an arbitrary integer, while `n=0;` will assign the integer `0` to `n.
     11How is an array allocated?::   An array variable `a` is declared with a decl such as `T a[];`, and then a statement such as `a=$new(T[n]);` will assign to `a` a new arbitrary array value for an array of length `n` of elements of type `T`.    For heap-allocation, a pointer is declared with a decl such as `T * p;`, and a heap variable is also declared somewhere with a decl such as `$heap heap;` and then a statement such as `p = $alloc(&heap, n, T);` will add a new object to the heap and return a pointer to the first element.  An `$alloc`-ed object can be deallocated with `$free(p);`.
     12
    1013* how to go between sequences and arrays
    1114* can you make types values? (reification)