Comment by foresto

1 year ago

Strictly speaking, or maybe just the way I personally think of it, sizeof doesn't return anything. It's not a function, so it doesn't return at all. (At least, not at run time.)

Nitpicking aside, the result of sizeof(*src) would be the size of the object at which the pointer points. The type of that result is size_t. That's what makes this code from the lesson I quoted invalid:

*sizeof(*src)

That first asterisk tries to dereference the result of sizeof as though it were a pointer, but it's a size_t: an unsigned integer type. Not a pointer.

Yea but that first asterisk is incorrect

  • Is there an echo in here? ;)

    • no lol you're just missing the question I am asking. obviously sizeof wont return a pointer. Im just saying, wouldn't it be `sizeof(usize)` essentially... or `sizeof(ptr_size_on_platform)`