Review: background information on
compilers
- Review:
- Information =
data +
context
- data = the
binary number
stored in
a variable
-
context =
the
data type of
a variable
|
-
Background information:
|
I can now
explain
the
reason to you...
How does a compiler translate
statements with variables
- If a variable y used
to computation:
has the data type
byte, the
compiler
must
translate the
statement to:
movw r0, #:lower16:y
movt r0, #:lower16:y
ldrsb r1, [r0]
|
to fetch the
value from the
byte typed
variable
|
(You saw in the
previous slides what
can go
wrong if you
don't !)
How does a compiler translate
statements with variables
-
On the other hand,
if a variable y used
to computation:
has the data type
short, the
compiler
must
translate the
statement to:
movw r0, #:lower16:y
movt r0, #:lower16:y
ldrsh r1, [r0]
|
to fetch the
value from the
short typed
variable
|
(You saw in the
previous slides what
can go
wrong if you
don't !)
How does a compiler translate
statements with variables
-
But,
if a variable y used
to computation:
has the data type
int, the
compiler
must
translate the
statement to:
movw r0, #:lower16:y
movt r0, #:lower16:y
ldr r1, [r0]
|
to fetch the
value from the
int typed
variable
|
(You saw in the
previous slides what
can go
wrong if you
don't !)
Reason
why
you need to
declare
global variables in C
Reason
why
you need to
declare
global variables in C
OLD DEMO:
/home/cs255001/demo/c/set1/c-1pass.c
(edit it)
❮
❯