Skip to content
Snippets Groups Projects
Commit fac2151c authored by Emil Kitti's avatar Emil Kitti
Browse files

bare0_3

parent 78976718
No related branches found
No related tags found
No related merge requests found
......@@ -21,9 +21,9 @@ fn main() {
let mut x = unsafe { X };
loop {
x += 1;
x = x.wrapping_add(1);
unsafe {
X += 1;
X = X.wrapping_add(1);
Y = X;
assert!(x == X && X == Y);
}
......@@ -70,10 +70,29 @@ fn main() {
// 3. change += opertions to wrapping_add
// place a breakpoint at line 22
// load and run the progam, what happens
// ** your answer here **
//
// Breakpoint 2, bare0::main () at examples/bare0.rs:24
// 24 x = x.wrapping_add(1);
// (gdb) print x
// $55 = 4294967295
// (gdb) next
// 26 X += 1;
// (gdb) print x
// $56 = 0
//
// now continue exectution, what happens
// ** your answer here **
//
// (gdb) print bare0::X
// $69 = 4294967295
// (gdb) next
// 27 Y = X;
// (gdb) print bare0::X
// $70 = 0
// (gdb) c
// Continuing.
//
// Breakpoint 2, bare0::main () at examples/bare0.rs:24
// 24 x = x.wrapping_add(1);
//
// commit your answers (bare0_3)
//
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment