Changeset 55f5c59


Ignore:
Timestamp:
May 30, 2017, 11:44:48 AM (7 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
d6fb3c7
Parents:
bff607e
Message:

more explanation of storage management options

File:
1 edited

Legend:

Unmodified
Added
Removed
  • doc/user/user.tex

    rbff607e r55f5c59  
    1111%% Created On       : Wed Apr  6 14:53:29 2016
    1212%% Last Modified By : Peter A. Buhr
    13 %% Last Modified On : Tue May 30 09:08:16 2017
    14 %% Update Count     : 2072
     13%% Last Modified On : Tue May 30 11:42:47 2017
     14%% Update Count     : 2097
    1515%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    1616
     
    52385238
    52395239The storage-management routines extend their C equivalents by overloading, alternate names, providing shallow type-safety, and removing the need to specify the allocation size for non-array types.
     5240
     5241Storage management provides the following capabilities:
     5242\begin{description}
     5243\item[fill]
     5244after allocation the storage is or is not filled with a specified character.
     5245\item[resize]
     5246an existing allocation is decreased or increased in size.
     5247In either case, new storage may or may not be allocated and, if there is a new allocation, as much data from the existing allocation is copied.
     5248For an increase in storage size, new storage after the copied data may or may not be filled.
     5249\item[alignment]
     5250an allocation starts on a specified memory boundary, e.g., an address multiple of 64 or 128 for cache-line purposes.
     5251\item[array]
     5252the allocation size is scaled to the specified number of array elements.
     5253An array may or not be filled, resized, or aligned.
     5254\end{description}
     5255
     5256The following table show the allocation routines supporting different combinations of storage-management capabilities:
    52405257\begin{center}
    52415258\begin{tabular}{@{}r|l|l|l|l@{}}
     
    52525269\end{tabular}
    52535270\end{center}
    5254 When ©amalloc© resizes and fills, the space after the copied data from the source is set to the fill character.
     5271% When ©amalloc© resizes and fills, the space after the copied data from the source is set to the fill character.
    52555272It is impossible to resize with alignment because the underlying ©realloc© allocates storage if more space is needed, and it does not honour alignment from the original allocation.
    52565273
     
    53385355\begin{cfa}[aboveskip=0pt,belowskip=0pt]
    53395356forall( otype T | { int ?<?( T, T ); } )        §\C{// location}§
    5340 T * bsearch( T key, const T * arr, size_t dimension );§\indexc{bsearch}§
     5357T * bsearch( T key, const T * arr, size_t dim );§\indexc{bsearch}§
    53415358
    53425359forall( otype T | { int ?<?( T, T ); } )        §\C{// position}§
    5343 unsigned int bsearch( T key, const T * arr, size_t dimension );
     5360unsigned int bsearch( T key, const T * arr, size_t dim );
    53445361
    53455362forall( otype T | { int ?<?( T, T ); } )
    5346 void qsort( const T * arr, size_t dimension );§\indexc{qsort}§
     5363void qsort( const T * arr, size_t dim );§\indexc{qsort}§
    53475364\end{cfa}
    53485365
Note: See TracChangeset for help on using the changeset viewer.