Guest User

Untitled

a guest
Aug 17th, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.21 KB | None | 0 0
  1. #[repr(C, packed)]
  2. struct Foo {
  3. a: u32,
  4. b: u32
  5. }
  6.  
  7. fn main() {
  8. let p: *const Foo = std::ptr::null();
  9. let b_offset = unsafe {
  10. &(*p).b as *const _ as usize
  11. };
  12. println!("{}", b_offset);
  13. }
Add Comment
Please, Sign In to add comment