Changes in libcfa/src/stdlib.hfa [4803a901:0f7a0ea]
- File:
-
- 1 edited
-
libcfa/src/stdlib.hfa (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/stdlib.hfa
r4803a901 r0f7a0ea 10 10 // Created On : Thu Jan 28 17:12:35 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Dec 12 13:52:34202013 // Update Count : 5 3612 // Last Modified On : Tue Dec 8 18:27:22 2020 13 // Update Count : 524 14 14 // 15 15 … … 49 49 50 50 static inline forall( dtype T | sized(T) ) { 51 // C FAsafe equivalents, i.e., implicit size specification51 // Cforall safe equivalents, i.e., implicit size specification 52 52 53 53 T * malloc( void ) { … … 234 234 235 235 static inline forall( dtype T | sized(T) ) { 236 // C FAsafe initialization/copy, i.e., implicit size specification, non-array types236 // Cforall safe initialization/copy, i.e., implicit size specification, non-array types 237 237 T * memset( T * dest, char fill ) { 238 238 return (T *)memset( dest, fill, sizeof(T) ); … … 243 243 } // memcpy 244 244 245 // C FAsafe initialization/copy, i.e., implicit size specification, array types245 // Cforall safe initialization/copy, i.e., implicit size specification, array types 246 246 T * amemset( T dest[], char fill, size_t dim ) { 247 247 return (T *)(void *)memset( dest, fill, dim * sizeof(T) ); // C memset … … 253 253 } // distribution 254 254 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 260 256 static inline forall( dtype T, ttype TT | { void free( TT ); } ) 261 void free( T * ptr, TT rest ) {262 free( ptr );257 void free( T * addr, TT rest ) { 258 free( ( void *)addr ); // use C free 263 259 free( rest ); 264 260 } // free 265 261 266 // C FAallocation/deallocation and constructor/destructor, non-array types262 // Cforall allocation/deallocation and constructor/destructor, non-array types 267 263 static inline forall( dtype T | sized(T), ttype TT | { void ?{}( T &, TT ); } ) 268 264 T * new( TT p ) { … … 276 272 ^(*ptr){}; // run destructor 277 273 } // if 278 free( ptr ); // always call free274 free( ptr ); 279 275 } // delete 276 280 277 static inline forall( dtype T, ttype TT | { void ^?{}( T & ); void delete( TT ); } ) 281 278 void delete( T * ptr, TT rest ) { … … 284 281 } // delete 285 282 286 // C FAallocation/deallocation and constructor/destructor, array types283 // Cforall allocation/deallocation and constructor/destructor, array types 287 284 forall( dtype T | sized(T), ttype TT | { void ?{}( T &, TT ); } ) T * anew( size_t dim, TT p ); 288 285 forall( dtype T | sized(T) | { void ^?{}( T & ); } ) void adelete( T arr[] );
Note:
See TracChangeset
for help on using the changeset viewer.