From cd0587c1fc627b53cac2f92d80920b29cc366b5b Mon Sep 17 00:00:00 2001 From: evanbiederstedt Date: Thu, 28 Oct 2021 16:31:26 -0400 Subject: [PATCH 1/3] add comments, Listing 5.6 Inspecting endianness --- ch5/ch5-endianness.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ch5/ch5-endianness.rs b/ch5/ch5-endianness.rs index 1601b933..5c829380 100644 --- a/ch5/ch5-endianness.rs +++ b/ch5/ch5-endianness.rs @@ -4,8 +4,8 @@ fn main() { let big_endian: [u8; 4] = [0xAA, 0xBB, 0xCC, 0xDD]; let little_endian: [u8; 4] = [0xDD, 0xCC, 0xBB, 0xAA]; - let a: i32 = unsafe { transmute(big_endian) }; <1> - let b: i32 = unsafe { transmute(little_endian) }; <1> + let a: i32 = unsafe { transmute(big_endian) }; // <1> + let b: i32 = unsafe { transmute(little_endian) }; // <1> println!("{} vs {}", a, b); } From 493c49c58357d7838b93d1dba99ceae6b1468cff Mon Sep 17 00:00:00 2001 From: evanbiederstedt Date: Fri, 29 Oct 2021 19:12:45 -0400 Subject: [PATCH 2/3] add comments to ch5-impossible-add.rs --- ch5/ch5-impossible-add.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ch5/ch5-impossible-add.rs b/ch5/ch5-impossible-add.rs index 82cdd0fa..5ee1a46d 100644 --- a/ch5/ch5-impossible-add.rs +++ b/ch5/ch5-impossible-add.rs @@ -1,7 +1,7 @@ -#[allow(arithmetic_overflow)] <1> +#[allow(arithmetic_overflow)] // <1> fn main() { let (a, b) = (200, 200); - let c: u8 = a + b; <2> + let c: u8 = a + b; // <2> println!("200 + 200 = {}", c); } From 5462239eaf81356aff8f38e45f208c12bea26ff9 Mon Sep 17 00:00:00 2001 From: evanbiederstedt Date: Fri, 29 Oct 2021 19:16:36 -0400 Subject: [PATCH 3/3] comments added to ch6-pointer-intro.rs --- ch6/ch6-pointer-intro.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ch6/ch6-pointer-intro.rs b/ch6/ch6-pointer-intro.rs index cd81c65c..d9b1a93f 100644 --- a/ch6/ch6-pointer-intro.rs +++ b/ch6/ch6-pointer-intro.rs @@ -3,8 +3,8 @@ static C: [u8; 11] = [116, 104, 97, 110, 107, 115, 102, 105, 115, 104, 0]; fn main() { let a = 42; - let b = &B; <1> - let c = &C; <1> + let b = &B; // <1> + let c = &C; // <1> - println!("a: {}, b: {:p}, c: {:p}", a, b, c); <2> + println!("a: {}, b: {:p}, c: {:p}", a, b, c); // <2> }