Ignore:
Timestamp:
May 28, 2024, 7:55:55 AM (7 months ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
master
Children:
8f7109c
Parents:
703885e
Message:

small proofreading changes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • doc/theses/mike_brooks_MMath/background.tex

    r703885e r4fc7388  
    714714\begin{c++}
    715715uSequence<NodeDL> sequence;
    716 sequence.add_front( node.nodeseq );             $\C{// link fields in embedded type}$
    717 NodeDL nodedl = sequence.remove( node.nodeseq );
    718 int i = nodedl.get().i;                                 $\C{// indirection to node}$
     716sequence.add_front( @node.nodeseq@ );   $\C{// link fields in embedded type}$
     717NodeDL nodedl = sequence.remove( @node.nodeseq@ );
     718int i = nodedl.@get()@.i;                               $\C{// indirection to node}$
    719719\end{c++}
    720720Hence, the \uCpp approach optimizes one set of intrusive links through the \CC inheritance mechanism, and falls back onto the LQ approach of explicit declarations for additional intrusive links.
     
    803803Technically, a string is an array whose elements are single characters.
    804804The compiler automatically places the null character @\0@ at the end of each such string, so programs can conveniently find the end.
    805 This representation means that there is no real limit to how long a string can be, but programs have to scan one completely to determine its length.
     805This representation means that there is no real limit to how long a string can be, but programs have to scan one completely to determine its length.~\cite[p.~36]{C:old}
    806806\end{quote}
    807807Unfortunately, this design decision is both unsafe and inefficient.
    808 It is common error in C to forget the space in a character array for the terminator or overwrite the terminator, resulting in array overruns in string operations.
     808It is common error in C to forget the storage in a character array for the terminator or overwrite the terminator, resulting in array overruns in string operations.
    809809The need to repeatedly scan an entire string to determine its length can result in significant cost, as it is impossible to cache the length in many cases.
    810810
    811811C strings are fixed size because arrays are used for the implementation.
    812 However, string manipulation commonly results in dynamically-sized temporary and final string values.
     812However, string manipulation commonly results in dynamically-sized temporary and final string values, \eg @strcpy@, @strcat@, @strcmp@, @strlen@, @strstr@, \etc.
    813813As a result, storage management for C strings is a nightmare, quickly resulting in array overruns and incorrect results.
    814814
    815815Collectively, these design decisions make working with strings in C, awkward, time consuming, and unsafe.
    816 While there are companion string routines that take the maximum lengths of strings to prevent array overruns, that means the semantics of the operation can fail because strings are truncated.
    817 Suffice it to say, C is not a go-to language for string applications, which is why \CC introduced the @string@ type.
     816While there are companion string routines that take the maximum lengths of strings to prevent array overruns, \eg @strncpy@, @strncat@, @strncpy@, that means the semantics of the operation can fail because strings are truncated.
     817Suffice it to say, C is not a go-to language for string applications, which is why \CC introduced the dynamically-sized @string@ type.
Note: See TracChangeset for help on using the changeset viewer.