• 1 Post
  • 12 Comments
Joined 1 year ago
cake
Cake day: June 14th, 2023

help-circle











  • Pointers also allow you to do fun and dangerous things like casting between types!

    For example, if you’re implementing your own memory allocator, at the base level your allocator only really cares about how many bytes are being requested (along with alignment, offset, other things) so you’d probably just implement it to return a char*, u8*, or void* pointing to the blob of memory you allocated with new, malloc, or whatever scheme you’ve cooked up. The calling code or higher level allocator code could then cast it to the actual type