Changeset 2d82999 for doc/theses/mike_brooks_MMath
- Timestamp:
- Apr 3, 2024, 12:24:23 PM (9 months ago)
- Branches:
- master
- Children:
- 4a72fef, d3a49864
- Parents:
- b5bfb16
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/theses/mike_brooks_MMath/background.tex
rb5bfb16 r2d82999 52 52 In these declarations, the resulting types are both arrays, but their lengths are inferred. 53 53 54 \begin{tabular}{lllllll}55 @float x;@ & $\rightarrow$ & (base element) & @float@ & @float x;@ & @[ float ]@ & @[ float ]@ \\56 @float * x;@ & $\rightarrow$ & pointer & @float *@ & @float * x;@ & @[ * float ]@ & @[ * float ]@ \\57 @float x[10];@ & $\rightarrow$ & array & @float[10]@ & @float x[10];@ & @[ [10] float ]@ & @[ array(float, 10) ]@ \\58 @float *x[10];@ & $\rightarrow$ & array of pointers & @(float*)[10]@ & @float *x[10];@ & @[ [10] * float ]@ & @[ array(*float, 10) ]@ \\59 @float (*x)[10];@ & $\rightarrow$ & pointer to array & @float(*)[10]@ & @float (*x)[10];@ & @[ * [10] float ]@ & @[ * array(float, 10) ]@ \\60 @float *(*x5)[10];@ & $\rightarrow$ & pointer to array & @(float*)(*)[10]@ & @float *(*x)[10];@ & @[ * [10] * float ]@ & @[ * array(*float, 10) ]@61 \end{tabular}62 \begin{cfa}63 x5 = (float*(*)[10]) x4;64 // x5 = (float(*)[10]) x4; // wrong target type; meta test suggesting above cast uses correct type65 66 // [here]67 // const68 69 // [later]70 // static71 // star as dimension72 // under pointer decay: int p1[const 3] being int const *p173 74 const float * y1;75 float const * y2;76 float * const y3;77 78 y1 = 0;79 y2 = 0;80 // y3 = 0; // bad81 82 // *y1 = 3.14; // bad83 // *y2 = 3.14; // bad84 *y3 = 3.14;85 86 const float z1 = 1.414;87 float const z2 = 1.414;88 89 // z1 = 3.14; // bad90 // z2 = 3.14; // bad91 92 93 }94 95 #define T float96 void stx2() { const T x[10];97 // x[5] = 3.14; // bad98 }99 void stx3() { T const x[10];100 // x[5] = 3.14; // bad101 }102 \end{cfa}103 104 54 My contribution is enabled by recognizing 105 55 \begin{itemize} … … 132 82 The \CFA-Full column gives the spelling of a different type, introduced in TODO, which has all of my contributed improvements for safety and ergonomics. 133 83 134 \noindent 135 \textbf{Unfortunate Syntactic Reference} 84 \VRef[Figure]{bkgd:ar:usr:avp} gives this reference for the discussion so far. 136 85 137 86 \begin{figure} … … 225 174 \\ \hline 226 175 \end{tabular} 227 \caption{Figure} 176 \caption{Unfortunate Syntactic Reference for Array vs Pointer. Includes interaction with constness.} 177 \label{bkgd:ar:usr:avp} 228 178 \end{figure} 179 180 181 182 183 184 TODO: Address these parked unfortunate syntaxes 185 \begin{itemize} 186 \item static 187 \item star as dimension 188 \item under pointer decay: int p1[const 3] being int const *p1 189 \end{itemize} 229 190 230 191 … … 323 284 \lstinput{32-42}{bkgd-carray-decay.c} 324 285 325 \noindent 326 \textbf{Unfortunate Syntactic Reference} 327 328 \noindent 329 (Parameter declaration; ``no writing'' refers to the callee's ability) 286 \VRef[Figure]{bkgd:ar:usr:decay-parm} gives the reference for the decay phenomenon seen in parameter decalarations. 330 287 331 288 \begin{figure} … … 364 321 \\ \hline 365 322 \end{tabular} 366 \caption{Figure} 323 \caption{Unfortunate Syntactic Reference for Decay during Parameter-Passing. Includes interaction with constness, where ``no writing'' refers to a restriction on the callee's ability.} 324 \label{bkgd:ar:usr:decay-parm} 367 325 \end{figure} 368 326
Note: See TracChangeset
for help on using the changeset viewer.