Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/stdlib.hfa

    r4803a901 r0f7a0ea  
    1010// Created On       : Thu Jan 28 17:12:35 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Dec 12 13:52:34 2020
    13 // Update Count     : 536
     12// Last Modified On : Tue Dec  8 18:27:22 2020
     13// Update Count     : 524
    1414//
    1515
     
    4949
    5050static inline forall( dtype T | sized(T) ) {
    51         // CFA safe equivalents, i.e., implicit size specification
     51        // Cforall safe equivalents, i.e., implicit size specification
    5252
    5353        T * malloc( void ) {
     
    234234
    235235static inline forall( dtype T | sized(T) ) {
    236         // CFA safe initialization/copy, i.e., implicit size specification, non-array types
     236        // Cforall safe initialization/copy, i.e., implicit size specification, non-array types
    237237        T * memset( T * dest, char fill ) {
    238238                return (T *)memset( dest, fill, sizeof(T) );
     
    243243        } // memcpy
    244244
    245         // CFA safe initialization/copy, i.e., implicit size specification, array types
     245        // Cforall safe initialization/copy, i.e., implicit size specification, array types
    246246        T * amemset( T dest[], char fill, size_t dim ) {
    247247                return (T *)(void *)memset( dest, fill, dim * sizeof(T) ); // C memset
     
    253253} // distribution
    254254
    255 // CFA deallocation for multiple objects
    256 static inline forall( dtype T )                                                 // FIX ME, problems with 0p in list
    257 void free( T * ptr ) {
    258         free( (void *)ptr );                                                            // C free
    259 } // free
     255// Cforall deallocation for multiple objects
    260256static inline forall( dtype T, ttype TT | { void free( TT ); } )
    261 void free( T * ptr, TT rest ) {
    262         free( ptr );
     257void free( T * addr, TT rest ) {
     258        free( ( void *)addr );                                                          // use C free
    263259        free( rest );
    264260} // free
    265261
    266 // CFA allocation/deallocation and constructor/destructor, non-array types
     262// Cforall allocation/deallocation and constructor/destructor, non-array types
    267263static inline forall( dtype T | sized(T), ttype TT | { void ?{}( T &, TT ); } )
    268264T * new( TT p ) {
     
    276272                ^(*ptr){};                                                                              // run destructor
    277273        } // if
    278         free( ptr );                                                                            // always call free
     274        free( ptr );
    279275} // delete
     276
    280277static inline forall( dtype T, ttype TT | { void ^?{}( T & ); void delete( TT ); } )
    281278void delete( T * ptr, TT rest ) {
     
    284281} // delete
    285282
    286 // CFA allocation/deallocation and constructor/destructor, array types
     283// Cforall allocation/deallocation and constructor/destructor, array types
    287284forall( dtype T | sized(T), ttype TT | { void ?{}( T &, TT ); } ) T * anew( size_t dim, TT p );
    288285forall( dtype T | sized(T) | { void ^?{}( T & ); } ) void adelete( T arr[] );
Note: See TracChangeset for help on using the changeset viewer.