Changes in / [95b1e28:a4248de1]


Ignore:
Location:
doc
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • doc/papers/general/Paper.tex

    r95b1e28 ra4248de1  
    203203The C programming language is a foundational technology for modern computing with millions of lines of code implementing everything from hobby projects to commercial operating-systems.
    204204This installation base and the programmers producing it represent a massive software-engineering investment spanning decades and likely to continue for decades more.
    205 Nevertheless, C, first standardized almost thirty years ago, lacks many features that make programming in more modern languages safer and more productive.
     205Nevertheless, C, first standardized almost forty years ago, lacks many features that make programming in more modern languages safer and more productive.
    206206
    207207The goal of the \CFA project (pronounced ``C-for-all'') is to create an extension of C that provides modern safety and productivity features while still ensuring strong backwards compatibility with C and its programmers.
  • doc/user/user.tex

    r95b1e28 ra4248de1  
    1111%% Created On       : Wed Apr  6 14:53:29 2016
    1212%% Last Modified By : Peter A. Buhr
    13 %% Last Modified On : Thu Jul 26 17:29:05 2018
    14 %% Update Count     : 3366
     13%% Last Modified On : Mon Jul  9 10:49:52 2018
     14%% Update Count     : 3361
    1515%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    1616
     
    59675967void * memalign( size_t align, size_t size );§\indexc{memalign}§
    59685968int posix_memalign( void ** ptr, size_t align, size_t size );§\indexc{posix_memalign}§
     5969}
     5970
     5971// §\CFA§ safe equivalents, i.e., implicit size specification
     5972forall( dtype T | sized(T) ) T * malloc( void );
     5973forall( dtype T | sized(T) ) T * calloc( size_t dim );
     5974forall( dtype T | sized(T) ) T * realloc( T * ptr, size_t size );
     5975forall( dtype T | sized(T) ) T * memalign( size_t align );
     5976forall( dtype T | sized(T) ) T * aligned_alloc( size_t align );
     5977forall( dtype T | sized(T) ) int posix_memalign( T ** ptr, size_t align );
     5978
     5979// §\CFA§ safe general allocation, fill, resize, array
     5980forall( dtype T | sized(T) ) T * alloc( void );§\indexc{alloc}§
     5981forall( dtype T | sized(T) ) T * alloc( char fill );
     5982forall( dtype T | sized(T) ) T * alloc( size_t dim );
     5983forall( dtype T | sized(T) ) T * alloc( size_t dim, char fill );
     5984forall( dtype T | sized(T) ) T * alloc( T ptr[], size_t dim );
     5985forall( dtype T | sized(T) ) T * alloc( T ptr[], size_t dim, char fill );
     5986
     5987// §\CFA§ safe general allocation, align, fill, array
     5988forall( dtype T | sized(T) ) T * align_alloc( size_t align );
     5989forall( dtype T | sized(T) ) T * align_alloc( size_t align, char fill );
     5990forall( dtype T | sized(T) ) T * align_alloc( size_t align, size_t dim );
     5991forall( dtype T | sized(T) ) T * align_alloc( size_t align, size_t dim, char fill );
    59695992
    59705993// C unsafe initialization/copy
     5994extern "C" {
    59715995void * memset( void * dest, int c, size_t size );
    59725996void * memcpy( void * dest, const void * src, size_t size );
    59735997}
    59745998
    5975 forall( dtype T | sized(T) ) {
    5976 // §\CFA§ safe equivalents, i.e., implicit size specification
    5977         T * malloc( void );
    5978         T * calloc( size_t dim );
    5979         T * realloc( T * ptr, size_t size );
    5980         T * memalign( size_t align );
    5981         T * aligned_alloc( size_t align );
    5982         int posix_memalign( T ** ptr, size_t align );
    5983 
    5984 // §\CFA§ safe general allocation, fill, resize, array
    5985         T * alloc( void );§\indexc{alloc}§
    5986         T * alloc( char fill );
    5987         T * alloc( size_t dim );
    5988         T * alloc( size_t dim, char fill );
    5989         T * alloc( T ptr[], size_t dim );
    5990         T * alloc( T ptr[], size_t dim, char fill );
    5991 
    5992 // §\CFA§ safe general allocation, align, fill, array
    5993         T * align_alloc( size_t align );
    5994         T * align_alloc( size_t align, char fill );
    5995         T * align_alloc( size_t align, size_t dim );
    5996         T * align_alloc( size_t align, size_t dim, char fill );
    5997 
    59985999// §\CFA§ safe initialization/copy, i.e., implicit size specification
    5999         T * memset( T * dest, char c );§\indexc{memset}§
    6000         T * memcpy( T * dest, const T * src );§\indexc{memcpy}§
     6000forall( dtype T | sized(T) ) T * memset( T * dest, char c );§\indexc{memset}§
     6001forall( dtype T | sized(T) ) T * memcpy( T * dest, const T * src );§\indexc{memcpy}§
    60016002
    60026003// §\CFA§ safe initialization/copy array
    6003         T * amemset( T dest[], char c, size_t dim );
    6004         T * amemcpy( T dest[], const T src[], size_t dim );
    6005 }
     6004forall( dtype T | sized(T) ) T * memset( T dest[], size_t dim, char c );
     6005forall( dtype T | sized(T) ) T * memcpy( T dest[], const T src[], size_t dim );
    60066006
    60076007// §\CFA§ allocation/deallocation and constructor/destructor
     
    60636063forall( otype T | { int ?<?( T, T ); } )
    60646064void qsort( const T * arr, size_t dim );§\indexc{qsort}§
    6065 
    6066 forall( otype E | { int ?<?( E, E ); } ) {
    6067         E * bsearch( E key, const E * vals, size_t dim );§\indexc{bsearch}§     §\C{// location}§
    6068         size_t bsearch( E key, const E * vals, size_t dim );§\C{// position}§
    6069         E * bsearchl( E key, const E * vals, size_t dim );§\indexc{bsearchl}§
    6070         size_t bsearchl( E key, const E * vals, size_t dim );
    6071         E * bsearchu( E key, const E * vals, size_t dim );§\indexc{bsearchu}§
    6072         size_t bsearchu( E key, const E * vals, size_t dim );
    6073 }
    6074 
    6075 forall( otype K, otype E | { int ?<?( K, K ); K getKey( const E & ); } ) {
    6076         E * bsearch( K key, const E * vals, size_t dim );
    6077         size_t bsearch( K key, const E * vals, size_t dim );
    6078         E * bsearchl( K key, const E * vals, size_t dim );
    6079         size_t bsearchl( K key, const E * vals, size_t dim );
    6080         E * bsearchu( K key, const E * vals, size_t dim );
    6081         size_t bsearchu( K key, const E * vals, size_t dim );
    6082 }
    6083 
    6084 forall( otype E | { int ?<?( E, E ); } ) {
    6085         void qsort( E * vals, size_t dim );§\indexc{qsort}§
    6086 }
    60876065\end{cfa}
    60886066
Note: See TracChangeset for help on using the changeset viewer.