Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/examples/sum.c

    rdd51906 rb63e376  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // sum.c -- test resolvers ability to deal with many variables with the same name and to use the minimum number of casts
    8 //    necessary to disambiguate overloaded variable names.
     7// sum.c --
    98//
    109// Author           : Peter A. Buhr
    1110// Created On       : Wed May 27 17:56:53 2015
    1211// Last Modified By : Peter A. Buhr
    13 // Last Modified On : Thu May 26 09:25:42 2016
    14 // Update Count     : 201
     12// Last Modified On : Fri Mar  4 15:06:47 2016
     13// Update Count     : 196
    1514//
    1615
     
    4948        } // for
    5049        sout | "sum from" | low | "to" | High | "is"
    51                  | (int)sum( size, a ) | ", check" | (int)s | endl;
     50                 | (int)sum( size, a ) | "" | ", check" | (int)s | endl;
    5251
    5352        int s = 0, a[size], v = low;
     
    5756        } // for
    5857        sout | "sum from" | low | "to" | High | "is"
    59                  | sum( size, (int *)a ) | ", check" | (int)s | endl;
     58                 | sum( size, (int *)a ) | "" | ", check" | (int)s | endl;
    6059
    6160        float s = 0.0, a[size], v = low / 10.0;
     
    6564        } // for
    6665        sout | "sum from" | low / 10.0 | "to" | High / 10.0 | "is"
    67                  | sum( size, (float *)a ) | ", check" | (float)s | endl;
     66                 | sum( size, (float *)a ) | "" | ", check" | (float)s | endl;
    6867
    6968        double s = 0, a[size], v = low / 10.0;
     
    7372        } // for
    7473        sout | "sum from" | low / 10.0 | "to" | High / 10.0 | "is"
    75                  | sum( size, (double *)a ) | ", check" | (double)s | endl;
     74                 | sum( size, (double *)a ) | "" | ", check" | (double)s | endl;
    7675
    7776        struct S { int i, j; } 0 = { 0, 0 }, 1 = { 1, 1 };
    78         S ?+?( S t1, S t2 ) { return (S){ t1.i + t2.i, t1.j + t2.j }; }
     77        S ?+?( S t1, S t2 ) { S s = { t1.i + t2.i, t1.j + t2.j }; return s; }
    7978        S ?+=?( S *t1, S t2 ) { *t1 = *t1 + t2; return *t1; }
    8079        S ++?( S *t ) { *t += 1; return *t; }
     
    8887        } // for
    8988        sout | "sum from" | low | "to" | High | "is"
    90                  | sum( size, (S *)a ) | ", check" | (S)s | endl;
     89                 | sum( size, (S *)a ) | "" | ", check" | (S)s | endl;
    9190} // main
    9291
Note: See TracChangeset for help on using the changeset viewer.