Ignore:
Timestamp:
Aug 25, 2022, 10:43:36 PM (20 months ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, ast-experimental, master, pthread-emulation
Children:
51fbba5
Parents:
d2f09e4
Message:

change C loop control to CFA loop control

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/stdlib.cfa

    rd2f09e4 rf6a4917  
    1010// Created On       : Thu Jan 28 17:10:29 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Feb 10 22:41:39 2022
    13 // Update Count     : 602
     12// Last Modified On : Thu Aug 25 22:41:14 2022
     13// Update Count     : 604
    1414//
    1515
     
    3535T * anew( size_t dim, TT p ) {
    3636        T * arr = alloc( dim );
    37         for ( unsigned int i = 0; i < dim; i += 1 ) {
     37        for ( i; dim ) {
    3838                (arr[i]){ p };                                                                  // run constructor
    3939        } // for
     
    4545        if ( arr ) {                                                                            // ignore null
    4646                size_t dim = malloc_size( arr ) / sizeof( T );
    47                 for ( int i = dim - 1; i >= 0; i -= 1 ) {               // reverse allocation order, must be unsigned
     47                for ( i; 0 -~= dim - 1 ) {                                              // reverse allocation order, must be unsigned
    4848                        ^(arr[i]){};                                                            // run destructor
    4949                } // for
     
    5656        if ( arr ) {                                                                            // ignore null
    5757                size_t dim = malloc_size( arr ) / sizeof( T );
    58                 for ( int i = dim - 1; i >= 0; i -= 1 ) {               // reverse allocation order, must be unsigned
     58                for ( i; 0 -~= dim - 1 ) {                                              // reverse allocation order, must be unsigned
    5959                        ^(arr[i]){};                                                            // run destructor
    6060                } // for
Note: See TracChangeset for help on using the changeset viewer.