Changes in src/examples/alloc.c [7937abf:6ba0659]
- File:
-
- 1 edited
-
src/examples/alloc.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/examples/alloc.c
r7937abf r6ba0659 11 11 // Created On : Wed Feb 3 07:56:22 2016 12 12 // Last Modified By : Peter A. Buhr 13 // Last Modified On : Fri Mar 11 17:42:08201614 // Update Count : 5913 // Last Modified On : Wed Feb 17 11:43:23 2016 14 // Update Count : 40 15 15 // 16 16 17 forall( otype T ) T * malloc( char fill );18 forall( dtype T ) T *?=?( T **, void * );19 void *malloc( unsigned long int );20 #if 021 17 #include <fstream> 22 18 #include <stdlib> … … 29 25 int * bar( int * p, int c ) { return p; } 30 26 int * baz( int * p, int c ) { return p; } 31 #endif32 27 33 28 int main( void ) { 34 #if 035 29 size_t size = 10; 36 30 int * p; 37 31 struct S { int x; double y; } * s; 38 #endif39 32 40 #if 041 33 p = malloc( sizeof(*p) ); // C malloc, type unsafe 42 34 printf( "here1\n" ); … … 45 37 printf( "here2\n" ); 46 38 free( p ); 47 #endif 48 // int * p; 49 // p = malloc( (char)'\0' ); // CFA malloc, type safe 50 (int *)malloc( (char)'\0' ); // CFA malloc, type safe 51 (void *)malloc( (char)'\0' ); // CFA malloc, type safe 52 #if 0 39 p = malloc( (char)'\0' ); // CFA malloc, type safe 53 40 printf( "here3\n" ); 54 41 p = malloc( p, 1000 ); // CFA remalloc, type safe … … 73 60 printf( "here9\n" ); 74 61 free( p ); 75 62 #if 0 76 63 float * fp = malloc() + 1; 77 64 fprintf( stderr, "%p %p\n", fp, fp - 1 );
Note:
See TracChangeset
for help on using the changeset viewer.