Ignore:
Timestamp:
May 24, 2024, 2:16:09 PM (20 months ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
master
Children:
df699e0
Parents:
76425bc
Message:

proofreading changes

File:
1 edited

Legend:

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

    r76425bc rc721105  
    33All modern programming languages provide three high-level containers (collection): array, linked-list, and string.
    44Often array is part of the programming language, while linked-list is built from pointer types, and string from a combination of array and linked-list.
     5For all three types, there is some corresponding mechanism for iterating through the structure, where the iterator flexibility varies with the kind of structure and ingenuity of the iterator implementor.
    56
    6 \cite{Blache19}
    7 \cite{Oorschot23}
    8 \cite{Ruef19}
    97
    108\section{Array}
    119
    12 Array provides a homogeneous container with $O(1)$ access to elements using subscripting.
     10An array provides a homogeneous container with $O(1)$ access to elements using subscripting (some form of pointer arithmetic).
    1311The array size can be static, dynamic but fixed after creation, or dynamic and variable after creation.
    1412For static and dynamic-fixed, an array can be stack allocated, while dynamic-variable requires the heap.
     13Because array layout has contiguous components, subscripting is a computation.
     14However, the computation can exceed the array bounds resulting in programming errors and security violations~\cite{Elliott18, Blache19, Ruef19, Oorschot23}.
     15The goal is to provide good performance with safety.
    1516
    1617
    1718\section{Linked List}
    1819
    19 Linked-list provides a homogeneous container with $O(log N)$/$O(N)$ access to elements using successor and predecessor operations.
     20A linked-list provides a homogeneous container often with $O(log N)$/$O(N)$ access to elements using successor and predecessor operations.
    2021Subscripting by value is sometimes available, \eg hash table.
    2122Linked types are normally dynamically sized by adding/removing nodes using link fields internal or external to the elements (nodes).
     
    2627\section{String}
    2728
    28 String provides a dynamic array of homogeneous elements, where the elements are often human-readable characters.
    29 What differentiates string from other types in that string operations work on blocks of elements for scanning and changing the elements, rather than accessing individual elements.
    30 Nevertheless, subscripting is often available.
    31 The cost of string operations is less important than the power of the block operation to accomplish complex manipulation.
    32 The dynamic nature of string means storage is normally heap allocated but often implicitly managed, even in unmanaged languages.
     29A string provides a dynamic array of homogeneous elements, where the elements are often human-readable characters.
     30What differentiates a string from other types in that its operations work on blocks of elements for scanning and changing the elements, rather than accessing individual elements, \eg @index@ and @substr@.
     31Subscripting individual elements is often available.
     32Often the cost of string operations is less important than the power of the operations to accomplish complex text manipulation, \eg search, analysing, composing, and decomposing.
     33The dynamic nature of a string means storage is normally heap allocated but often implicitly managed, even in unmanaged languages.
    3334
    3435
    3536\section{Motivation}
    3637
    37 The goal of this work is to introduce safe and complex versions of array, link-lists, and string into the programming language \CFA~\cite{Cforall}, which is based on C.
     38The goal of this work is to introduce safe and complex versions of array, link lists, and strings into the programming language \CFA~\cite{Cforall}, which is based on C.
    3839Unfortunately, to make C better, while retaining a high level of backwards compatibility, requires a significant knowledge of C's design.
    3940Hence, it is assumed the reader has a medium knowledge of C or \CC, on which extensive new C knowledge is built.
     
    4546However, most programming languages are only partially explained by standard's manuals.
    4647When it comes to explaining how C works, the definitive source is the @gcc@ compiler, which is mimicked by other C compilers, such as Clang~\cite{clang}.
    47 Often other C compilers must \emph{ape} @gcc@ because a large part of the C library (runtime) system contains @gcc@ features.
     48Often other C compilers must mimic @gcc@ because a large part of the C library (runtime) system contains @gcc@ features.
    4849While some key aspects of C need to be explained by quoting from the language reference manual, to illustrate definite program semantics, I devise a program, whose behaviour exercises the point at issue, and shows its behaviour.
    4950These example programs show
     
    5556This work has been tested across @gcc@ versions 8--12 and clang version 10 running on ARM, AMD, and Intel architectures.
    5657Any discovered anomalies among compilers or versions is discussed.
    57 In this case, I do not argue that my sample of major Linux compilers is doing the right thing with respect to the C standard.
     58In all case, I do not argue that my sample of major Linux compilers is doing the right thing with respect to the C standard.
    5859
    5960
     
    7677\end{cfa}
    7778with a segmentation fault at runtime.
    78 Clearly, @gcc@ understands these ill-typed case, and yet allows the program to compile, which seems like madness.
    79 Compiling with flag @-Werror@, which turns warnings into errors, is often too strong, because some warnings are just warnings.
     79Clearly, @gcc@ understands these ill-typed case, and yet allows the program to compile, which seems inappropriate.
     80Compiling with flag @-Werror@, which turns warnings into errors, is often too strong, because some warnings are just warnings, \eg unsed variable.
    8081In the following discussion, ``ill-typed'' means giving a nonzero @gcc@ exit condition with a message that discusses typing.
    8182Note, \CFA's type-system rejects all these ill-typed cases as type mismatch errors.
     
    99100
    100101\subsection{String}
     102
     103\subsection{Iterator}
Note: See TracChangeset for help on using the changeset viewer.