Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/tests/swap.c

    r3dcd347a rcb811ac  
    77// swap.c --
    88//
    9 // Author           : Richard C. Bilson
     9// Author           : Peter A. Buhr
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Apr 21 08:10:41 2016
    13 // Update Count     : 69
     12// Last Modified On : Wed Aug 23 20:34:45 2017
     13// Update Count     : 70
    1414//
    1515
     
    2020        char c1 = 'a', c2 = 'b';
    2121        sout | "char\t\t\t" | c1 | ' ' | c2 | "\t\t\tswap ";
    22         swap( &c1, &c2 );
     22        swap( c1, c2 );
    2323        sout | '\t' | c1 | ' ' | c2 | endl;
    2424
    2525        signed int i1 = -1, i2 = -2;
    2626        sout | "signed int\t\t" | i1 | i2 | "\t\t\tswap ";
    27         swap( &i1, &i2 );
     27        swap( i1, i2 );
    2828        sout | '\t' | i1 | i2 | endl;
    2929
    3030        unsigned int ui1 = 1, ui2 = 2;
    3131        sout | "unsigned int\t\t" | ui1 | ui2 | "\t\t\tswap ";
    32         swap( &ui1, &ui2 );
     32        swap( ui1, ui2 );
    3333        sout | '\t' | ui1 | ui2 | endl;
    3434
    3535        signed long int li1 = -1, li2 = -2;
    3636        sout | "signed long int\t\t" | li1 | li2 | "\t\t\tswap ";
    37         swap( &li1, &li2 );
     37        swap( li1, li2 );
    3838        sout | '\t' | li1 | li2 | endl;
    3939
    4040        unsigned long int uli1 = 1, uli2 = 2;
    4141        sout | "unsigned long int\t" | uli1 | uli2 | "\t\t\tswap ";
    42         swap( &uli1, &uli2 );
     42        swap( uli1, uli2 );
    4343        sout | '\t' | uli1 | uli2 | endl;
    4444
    4545        signed long long int lli1 = -1, lli2 = -2;
    4646        sout | "signed long long int\t" | lli1 | lli2 | "\t\t\tswap ";
    47         swap( &lli1, &lli2 );
     47        swap( lli1, lli2 );
    4848        sout | '\t' | lli1 | lli2 | endl;
    4949
    5050        unsigned long long int ulli1 = 1, ulli2 = 2;
    5151        sout | "unsigned long long int\t" | ulli1 | ulli2 | "\t\t\tswap ";
    52         swap( &ulli1, &ulli2 );
     52        swap( ulli1, ulli2 );
    5353        sout | '\t' | ulli1 | ulli2 | endl;
    5454
    5555        float f1 = 1.5, f2 = 2.5;
    5656        sout | "float\t\t\t" | f1 | f2 | "\t\t\tswap ";
    57         swap( &f1, &f2 );
     57        swap( f1, f2 );
    5858        sout | '\t' | f1 | f2 | endl;
    5959
    6060        double d1 = 1.5, d2 = 2.5;
    6161        sout | "double\t\t\t" | d1 | d2 | "\t\t\tswap ";
    62         swap( &d1, &d2 );
     62        swap( d1, d2 );
    6363        sout | '\t' | d1 | d2 | endl;
    6464
    6565        long double ld1 = 1.5, ld2 = 2.5;
    6666        sout | "long double\t\t" | ld1 | ld2 | "\t\t\tswap ";
    67         swap( &ld1, &ld2 );
     67        swap( ld1, ld2 );
    6868        sout | '\t' | ld1 | ld2 | endl;
    6969
    7070        float _Complex fc1 = 1.5f+1.5if, fc2 = 2.5f+2.5if;
    7171        sout | "float _Complex\t\t" | fc1 | fc2 | "\tswap ";
    72         swap( &fc1, &fc2 );
     72        swap( fc1, fc2 );
    7373        sout | '\t' | fc1 | fc2 | endl;
    7474
    7575        double _Complex dc1 = 1.5d+1.5id, dc2 = 2.5d+2.5id;
    7676        sout | "double _Complex\t\t" | dc1 | dc2 | "\tswap ";
    77         swap( &dc1, &dc2 );
     77        swap( dc1, dc2 );
    7878        sout | '\t' | dc1 | dc2 | endl;
    7979
    8080        long double _Complex ldc1 = 1.5d+1.5il, ldc2 = 2.5d+2.5il;
    8181        sout | "long double _Complex\t" | ldc1 | ldc2 | "\tswap ";
    82         swap( &ldc1, &ldc2 );
     82        swap( ldc1, ldc2 );
    8383        sout | '\t' | ldc1 | ldc2 | endl;
    8484
     
    8686        ofstream * ?|?( ofstream * os, S s ) { return os | s.i | s.j; }
    8787        sout | "struct S\t\t" | s1 | "," | s2 | "\t\tswap ";
    88         swap( &s1, &s2 );
     88        swap( s1, s2 );
    8989        sout | '\t' | s1 | "," | s2 | endl;
    9090} // main
Note: See TracChangeset for help on using the changeset viewer.