diff --git a/semester3/spca/parts/00_asm/02_dtype-dstruct/00_data-types.tex b/semester3/spca/parts/00_asm/02_dtype-dstruct/00_data-types.tex index b239c14..db74a46 100644 --- a/semester3/spca/parts/00_asm/02_dtype-dstruct/00_data-types.tex +++ b/semester3/spca/parts/00_asm/02_dtype-dstruct/00_data-types.tex @@ -17,3 +17,4 @@ They are stored and operated on in floating point registers. \end{tables} Assembly does not support any aggregate types (such as arrays, structs, etc) natively. You can however (obviously) make your own. In the following section we will cover how \lC\ datatypes are compiled into assembly. +Do note that the \texttt{sizeof} function in \lC\ returns the number of bytes. diff --git a/semester3/spca/parts/00_asm/02_dtype-dstruct/02_structs.tex b/semester3/spca/parts/00_asm/02_dtype-dstruct/02_structs.tex index 6a3455a..4dfff0c 100644 --- a/semester3/spca/parts/00_asm/02_dtype-dstruct/02_structs.tex +++ b/semester3/spca/parts/00_asm/02_dtype-dstruct/02_structs.tex @@ -20,5 +20,7 @@ For alignment on \texttt{x86-64} we have: \end{multicols} \dhrmvspace +On 64 bit Linux, using \texttt{gcc}, structs are compiled according to this concept and the size is \texttt{n * k} bytes. + Another issue is accessing members. The solution to this is however easy and efficient, as at compile time, the offsets are pre-determined and compiled into the setter and/or getter code for the struct. diff --git a/semester3/spca/parts/01_c/01_basics/01_control-flow.tex b/semester3/spca/parts/01_c/01_basics/01_control-flow.tex index 790d62b..4a6b1be 100644 --- a/semester3/spca/parts/01_c/01_basics/01_control-flow.tex +++ b/semester3/spca/parts/01_c/01_basics/01_control-flow.tex @@ -5,7 +5,7 @@ A note of caution when using goto: It is almost never a good idea (can lead to u Where it however is very handy is for error recovery (and cleanup functions) and early termination of multiple loops (jumping out of a loop). So, for example, if you have to run multiple functions to set something up and one of them fails, you can jump to a label and have all cleanup code execute that you have specified there. -And because the labels are (as in Assembly) simply skipped over during execution, you can make very nice cleanup code. +And because the labels are (as in Assembly) skipped over during execution, you can make very nice cleanup code. We can also use \texttt{continue} and \texttt{break} statements similarly to \texttt{Java}, they do not however accept labels. (Reminder: \texttt{continue} skips the loop body and goes to the next iteration) diff --git a/semester3/spca/spca-summary.pdf b/semester3/spca/spca-summary.pdf index 2075f06..437ca11 100644 Binary files a/semester3/spca/spca-summary.pdf and b/semester3/spca/spca-summary.pdf differ