Changeset 195f43d for doc/theses/mike_brooks_MMath/background.tex
- Timestamp:
- Mar 13, 2025, 9:21:17 AM (2 weeks ago)
- Branches:
- master
- Children:
- 3bd9508
- Parents:
- 3483185
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified doc/theses/mike_brooks_MMath/background.tex ¶
r3483185 r195f43d 468 468 \VRef[Figure]{f:ContiguousNon-contiguous} shows a powerful extension made in C99 for manipulating contiguous \vs non-contiguous arrays.\footnote{C90 also supported non-contiguous arrays.} 469 469 For contiguous-array (including VLA) arguments, C99 conjoins one or more of the parameters as a downstream dimension(s), \eg @cols@, implicitly using this parameter to compute the row stride of @m@. 470 There is now sufficient information to support subscript checking along the columns to prevent buffer-overflow problems, but subscript checking is notprovided.470 There is now sufficient information to support array copying and subscript checking along the columns to prevent changing the argument or buffer-overflow problems, but neither feature is provided. 471 471 If the declaration of @fc@ is changed to: 472 472 \begin{cfa} … … 1221 1221 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.~\cite[p.~36]{C:old} 1222 1222 \end{quote} 1223 Unfortunately, this design decision is both unsafe and inefficient. 1224 It 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. 1225 The 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. 1223 This property is only preserved by the compiler with respect to character constants, \eg @"abc"@ is actually @"abc\0"@, \ie 4 characters rather than 3. 1224 Otherwise, the compiler does not participate, making string operations both unsafe and inefficient. 1225 For example, it is common in C to: forget that a character constant is larger than it appears during manipulation, that extra storage is needed in a character array for the terminator, or that the terminator must be preserved during string operations, otherwise there are array overruns. 1226 Finally, the 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, \eg when a string is passed into another function. 1226 1227 1227 1228 C strings are fixed size because arrays are used for the implementation.
Note: See TracChangeset
for help on using the changeset viewer.