Changeset ed79428


Ignore:
Timestamp:
Dec 12, 2023, 11:29:06 AM (12 months ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
master
Children:
7972603
Parents:
cd79053
Message:

comment out missing lstinputlisting files, fix missing @'s for lstinline code

File:
1 edited

Legend:

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

    rcd79053 red79428  
    4040
    4141TODO: typeset
    42 \lstinputlisting[language=C, firstline=13, lastline=56]{bkgd-c-tyerr.c}
     42%\lstinputlisting[language=C, firstline=13, lastline=56]{bkgd-c-tyerr.c}
    4343
    4444
     
    4848
    4949TODO: typeset
    50 \lstinputlisting[language=C, firstline=35, lastline=116]{bkgd-carray-arrty.c}
     50%\lstinputlisting[language=C, firstline=35, lastline=116]{bkgd-carray-arrty.c}
    5151
    5252My contribution is enabled by recognizing
     
    176176
    177177TODO: typeset
    178 \lstinputlisting[language=C, firstline=4, lastline=26]{bkgd-carray-decay.c}
     178%\lstinputlisting[language=C, firstline=4, lastline=26]{bkgd-carray-decay.c}
    179179
    180180
     
    229229the parameter's type becomes a type that I summarize as being the array-decayed type.
    230230The respective handlings of the following two parameter spellings shows that the array-spelled one is really, like the other, a pointer.
    231 \lstinputlisting[language=C, firstline=40, lastline=44]{bkgd-carray-decay.c}
     231%\lstinputlisting[language=C, firstline=40, lastline=44]{bkgd-carray-decay.c}
    232232As the @sizeof(x)@ meaning changed, compared with when run on a similarly-spelled local variariable declaration,
    233233GCC also gives this code the warning: ```sizeof' on array function parameter `x' will return size of `float *'.''
    234234
    235235The caller of such a function is left with the reality that a pointer parameter is a pointer, no matter how it's spelled:
    236 \lstinputlisting[language=C, firstline=60, lastline=63]{bkgd-carray-decay.c}
     236%\lstinputlisting[language=C, firstline=60, lastline=63]{bkgd-carray-decay.c}
    237237This fragment gives no warnings.
    238238
     
    240240Note the opposite meaning of this spelling now, compared with its use in local variable declarations.
    241241This point of confusion is illustrated in:
    242 \lstinputlisting[language=C, firstline=80, lastline=87]{bkgd-carray-decay.c}
     242%\lstinputlisting[language=C, firstline=80, lastline=87]{bkgd-carray-decay.c}
    243243The basic two meanings, with a syntactic difference helping to distinguish,
    244244are illustrated in the declarations of @ca@ vs.\ @cp@,
     
    259259Pointer decay does not affect pointer-to-array types, because these are already pointers, not arrays.
    260260As a result, a function with a pointer-to-array parameter sees the parameter exactly as the caller does:
    261 \lstinputlisting[language=C, firstline=100, lastline=110]{bkgd-carray-decay.c}
     261%\lstinputlisting[language=C, firstline=100, lastline=110]{bkgd-carray-decay.c}
    262262
    263263
     
    414414which type information associated with a polymorphic return type
    415415replaces @malloc@'s use of programmer-supplied size information.
    416 \begin{lstinline}
     416\begin{lstlisting}
    417417    // C, library
    418418    void * malloc( size_t );
     
    426426    tm * el2 = alloc();
    427427    tm (*ar2)[10] = alloc();
    428 \end{lstinline}
     428\end{lstlisting}
    429429The alloc polymorphic return compiles into a hidden parameter, which receives a compiler-generated argument.
    430430This compiler's argument generation uses type information from the left-hand side of the initialization to obtain the intended type.
     
    436436In the last example, the choice of ``pointer to array'' @ar2@ breaks a parallel with @ar1@.
    437437They are not subscripted in the same way.
    438 \begin{lstinline}
     438\begin{lstlisting}
    439439    ar1[5];
    440440    (*ar2)[5];
    441 \end{lstinline}
     441\end{lstlisting}
    442442Using ``reference to array'' works at resolving this issue.  TODO: discuss connection with Doug-Lea \CC proposal.
    443 \begin{lstinline}
     443\begin{lstlisting}
    444444    tm (&ar3)[10] = *alloc();
    445445    ar3[5];
    446 \end{lstinline}
     446\end{lstlisting}
    447447The implicit size communication to @alloc@ still works in the same ways as for @ar2@.
    448448
    449 Using proper array types (@ar2@ and @ar3@) addresses a concern about using raw element pointers (@ar1), albeit a theoretical one.
     449Using proper array types (@ar2@ and @ar3@) addresses a concern about using raw element pointers (@ar1@), albeit a theoretical one.
    450450TODO xref C standard does not claim that @ar1@ may be subscripted,
    451451because no stage of interpreting the construction of @ar1@ has it be that ``there is an \emph{array object} here.''
     
    453453where the type requested is an array, making the result, much more obviously, an array object.
    454454
    455 The ``reference to array'' type has its sore spots too.  TODO see also dimexpr-match-c/REFPARAM_CALL (under TRY_BUG_1)
     455The ``reference to array'' type has its sore spots too.  TODO see also @dimexpr-match-c/REFPARAM_CALL (under TRY_BUG_1)@
    456456
    457457
Note: See TracChangeset for help on using the changeset viewer.