Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/tests/tuplePolymorphism.c

    r17e0dc9 rebb5ed9  
    99// Author           : Rob Schluntz
    1010// Created On       : Tue Nov 16 10:38:00 2016
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu May 18 18:05:12 2017
    13 // Update Count     : 4
     11// Last Modified By : Rob Schluntz
     12// Last Modified On : Tue Nov 16 10:39:18 2016
     13// Update Count     : 2
    1414//
    1515
    1616// packed is needed so that structs are not passed with the same alignment as function arguments
    1717__attribute__((packed)) struct A {
    18         double x;
    19         char y;
    20         double z;
     18  double x;
     19  char y;
     20  double z;
    2121};
    2222
    2323__attribute__((packed)) struct B {
    24         long long x;
    25         char y;
    26         long long z;
     24  long long x;
     25  char y;
     26  long long z;
    2727};
    2828
     
    3939
    4040int main() {
    41         int x1 = 123, x3 = 456;
    42         double x2 = 999.123;
     41  int x1 = 123, x3 = 456;
     42  double x2 = 999.123;
    4343
    44         int i1 = 111, i3 = 222;
    45         double i2 = 333;
     44  int i1 = 111, i3 = 222;
     45  double i2 = 333;
    4646
    47         int d1 = 555, d3 = 444;
    48         double d2 = 666;
     47  int d1 = 555, d3 = 444;
     48  double d2 = 666;
    4949
    5050
    51         [i1, i2, i3] = ([x1, (int)x2, x3]) + ([9, 2, 3]);
    52         [d1, d2, d3] = ([x1, x2, x3]) + ([9, 2, 3]);
    53         printf("%d %g %d\n", i1, i2, i3);
    54         printf("%d %g %d\n", d1, d2, d3);
     51  [i1, i2, i3] = ([x1, (int)x2, x3]) + ([9, 2, 3]);
     52  [d1, d2, d3] = ([x1, x2, x3]) + ([9, 2, 3]);
     53  printf("%d %g %d\n", i1, i2, i3);
     54  printf("%d %g %d\n", d1, d2, d3);
    5555
    56         [double, double, double] zzz;
    57         zzz = [x1, x2, x3];
    58         printf("%g %g %g\n", zzz);
    59         [x1, x2, x3] = zzz+zzz;
    60         printf("%d %g %d\n", x1, x2, x3);
     56  [double, double, double] zzz;
     57  zzz = [x1, x2, x3];
     58  printf("%g %g %g\n", zzz);
     59  [x1, x2, x3] = zzz+zzz;
     60  printf("%d %g %d\n", x1, x2, x3);
    6161
    62         // ensure non-matching assertions are specialized correctly
    63         g((A){ 1.21, 'x', 10.21}, (B){ 1111LL, 'v', 54385938LL });
     62  // ensure non-matching assertions are specialized correctly
     63  g((A){ 1.21, 'x', 10.21}, (B){ 1111LL, 'v', 54385938LL });
    6464}
    6565
     
    7373// tab-width: 4 //
    7474// End: //
     75
Note: See TracChangeset for help on using the changeset viewer.