• Ephera
    link
    32 years ago

    If you place data in a struct, you usually want that to be owned by that struct, so you usually don’t want to store a reference in a struct.

    If you pass data around as parameters, you usually do want to pass those by reference, except for simple data types, i.e. anything that is itself smaller or the same size as a pointer.
    For example, on a 64-bit system pointers have a size of 64 bits, so u8, u16, u32, u64, i8 etc. can all be passed around by value (they’ll automatically get copied).