Skip to content

Instantly share code, notes, and snippets.

@mppf
mppf / order-independent-vs-loop-carried.chpl
Last active July 7, 2017 18:34
order independent vs loop carried
var sum: int;
for i in vectorizeOnly(1..n) {
sum += i; // is sum "order independent" ? Is there a loop-carried dependency to respect?
// say it turns in to
// %1 = load %sum
// %2 = add %1, i
// store %2, %sum
// would it be wrong to assert there is no loop-carried dependency?
}
record R {
var x: int;
proc deinit() {
writeln("Destroying ", x);
}
}
proc foo() {
var count = 0;
@mppf
mppf / a.d
Created June 20, 2017 14:19
D lang array resize pointer safety example
/* compile with ldc2 a.d */
module a;
import std.stdio;
@safe
int main()
{
int[] array;
array.length = 7;