Using sizeof() in functions

Ive found that pretty much all libraries ive used, use a format similar to

sendPacket(void *payload, uint16_t size)

Meaning a they require the user to give the size of the array, class or struct into the function.
Is the use of sizeof() not reliable? I would think that it would make interfacing much simpler and to omit the size input so:

sendPacket(void *payload) {
    uint16_t size = sizeof(*payload)
    ...
}

sizeof is reliable (how can you just imagine ...)

but you handover only a pointer to a variable, and if you need the size in the function, you also have to handover the size to the function.

just do a testsketch and you will see.

Yo90bosses:
Ive found that pretty much all libraries ive used, use a format similar to

sendPacket(void *payload, uint16_t size)

Meaning a they require the user to give the size of the array, class or struct into the function.
Is the use of sizeof() not reliable? I would think that it would make interfacing much simpler and to omit the size input so:

sendPacket(void *payload) {

uint16_t size = sizeof(*payload)
    ...
}

payload is not only a pointer, it is a void pointer. You know neither the type nor size of the buffer passed. It is simply a pointer to a memory location.