diff --git a/examples/rtic_bare1.rs b/examples/rtic_bare1.rs index 31b5636e6918bacbd0029d541de83eb8cf75cf8d..a173320ce2d47a965abd25e78a546cf12fadc0dd 100644 --- a/examples/rtic_bare1.rs +++ b/examples/rtic_bare1.rs @@ -76,7 +76,7 @@ const APP: () = { // // Explain in your own words the chain of calls. // -// App calls init, init initializes a mutable variable x to int max -1 +// App calls init, init initializes a mutable variable x to int max -2 // init loops while adding to x, x goes over max, rust calls panic // panic calls panic_format, panic_fmt calls semihosting_panic // panic semihosting calls brakpoint. @@ -92,11 +92,11 @@ const APP: () = { // // What is the value of `x`? // -// ** your answer here ** +// 4294967294 // // Explain in your own words where this value comes from. // -// ** your answer here ** +// core::u32::MAX = 4294967295 = 2^32-1; we assign x to be MAX-1 // // Now continue the program, since you are in a loop // the program will halt again at line 24. @@ -105,7 +105,7 @@ const APP: () = { // // Explain in your own words why `x` now has this value. // -// ** your answer here ** +// we added 1 to x // // Now continue again. // @@ -119,7 +119,9 @@ const APP: () = { // // Explain in your own words why a panic makes sense at this point. // -// ** your answer here ** +// Since x had the value of MAX which is the maximum value x can't get bigger. +// since the purpose of adding to a variable is to make it bigger, +// and if it can't get any bigger rust has chosen to panic. // // Commit your answer (bare1_3) //