mirror of
https://github.com/janishutz/eth-summaries.git
synced 2026-03-14 10:50:05 +01:00
[SPCA] fix formatting errors, add notes
This commit is contained in:
@@ -17,3 +17,4 @@ They are stored and operated on in floating point registers.
|
|||||||
\end{tables}
|
\end{tables}
|
||||||
Assembly does not support any aggregate types (such as arrays, structs, etc) natively. You can however (obviously) make your own.
|
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.
|
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.
|
||||||
|
|||||||
@@ -20,5 +20,7 @@ For alignment on \texttt{x86-64} we have:
|
|||||||
\end{multicols}
|
\end{multicols}
|
||||||
|
|
||||||
\dhrmvspace
|
\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
|
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.
|
and compiled into the setter and/or getter code for the struct.
|
||||||
|
|||||||
@@ -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).
|
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,
|
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.
|
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.
|
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)
|
(Reminder: \texttt{continue} skips the loop body and goes to the next iteration)
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user