Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/examples/alloc.c

    r7937abf r6ba0659  
    1111// Created On       : Wed Feb  3 07:56:22 2016
    1212// Last Modified By : Peter A. Buhr
    13 // Last Modified On : Fri Mar 11 17:42:08 2016
    14 // Update Count     : 59
     13// Last Modified On : Wed Feb 17 11:43:23 2016
     14// Update Count     : 40
    1515//
    1616
    17 forall( otype T ) T * malloc( char fill );
    18 forall( dtype T ) T *?=?( T **, void * );
    19 void *malloc( unsigned long int );
    20 #if 0
    2117#include <fstream>
    2218#include <stdlib>
     
    2925int * bar( int * p, int c ) { return p; }
    3026int * baz( int * p, int c ) { return p; }
    31 #endif
    3227
    3328int main( void ) {
    34 #if 0
    3529    size_t size = 10;
    3630    int * p;
    3731    struct S { int x; double y; } * s;
    38 #endif
    3932
    40 #if 0
    4133    p = malloc( sizeof(*p) );                                                   // C malloc, type unsafe
    4234        printf( "here1\n" );
     
    4537        printf( "here2\n" );
    4638    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
    5340        printf( "here3\n" );
    5441    p = malloc( p, 1000 );                                                              // CFA remalloc, type safe
     
    7360        printf( "here9\n" );
    7461    free( p );
    75 
     62#if 0
    7663    float * fp = malloc() + 1;
    7764    fprintf( stderr, "%p %p\n", fp, fp - 1 );
Note: See TracChangeset for help on using the changeset viewer.