CS3214 Fall 2011
Monday, Sep 19, 2011. 11:59pm (no extensions).
What to submit:
A tar ﬁle that should contain the following ﬁles:
ASCII ﬁle with answers for questions 1, 2, and 3. For answers 4-6, which ask for code,
include ﬁles named
in your tar ﬁle.
Use the submit.pl script in
cs3214/bin/submit.pl to submit your tar ﬁle from the com-
mand line, or use the submit website. Use the identiﬁer ’ex3.’
This exercise is intended to reinforce the content of lectures 3-6. As before, you’re asked
to use gcc 4.1.2 as installed on the rlogin cluster. Specify the
switch unless the question
As discussed in lecture and the book, a C compiler may
use padding to align ﬁelds in a struct according to a set of conventions, which
vary between architectures, OSs, and sometimes compiler versions. The directory
cs3214/bin contains three compilers
. Find out at which
multiples these compiler align ﬁelds of types
. Which com-
piler uses the default alignment used on Linux/x86
64 default alignment rules (yes/no)?
Variations on Passing Arguments.
As discussed in lecture, there are different ways
in which a function might prepare the arguments for the function(s) it calls, without
violating the assumptions made by the IA32 ABI speciﬁcation. It is useful to gain
an intuition regarding these variations.
Consider the following variation of the
function shown in Lecture.
int t0 =
int t1 =
yp = t0;
xp = t1;
int zip1 = 15213;
int zip2 = 91125;