Changeset f277ab6c
- Timestamp:
- Dec 12, 2023, 2:35:39 PM (12 months ago)
- Branches:
- master
- Children:
- c40157e
- Parents:
- 7972603
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/theses/mike_brooks_MMath/background.tex
r7972603 rf277ab6c 40 40 41 41 TODO: 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} 43 43 44 44 … … 48 48 49 49 TODO: 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} 51 51 52 52 My contribution is enabled by recognizing … … 176 176 177 177 TODO: 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} 179 179 180 180 … … 229 229 the parameter's type becomes a type that I summarize as being the array-decayed type. 230 230 The 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} 232 232 As the @sizeof(x)@ meaning changed, compared with when run on a similarly-spelled local variariable declaration, 233 233 GCC also gives this code the warning: ```sizeof' on array function parameter `x' will return size of `float *'.'' 234 234 235 235 The 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} 237 237 This fragment gives no warnings. 238 238 … … 240 240 Note the opposite meaning of this spelling now, compared with its use in local variable declarations. 241 241 This 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} 243 243 The basic two meanings, with a syntactic difference helping to distinguish, 244 244 are illustrated in the declarations of @ca@ vs.\ @cp@, … … 259 259 Pointer decay does not affect pointer-to-array types, because these are already pointers, not arrays. 260 260 As 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} 262 262 263 263
Note: See TracChangeset
for help on using the changeset viewer.