3 ms·
> Arguably, the void* does that as well? How do you figure? The type is a pointer to quite literally anything, including nothing (ie a pointer that cannot be d
by throwaway27448 5mo ago
> Arguably, the void* does that as well?
How do you figure? The type is a pointer to quite literally anything, including nothing (ie a pointer that cannot be dereferenced). If you're working with bytes, indicate this with the type.
- addaon 5mo ago> The type is a pointer to quite literally anything No, it can only be a pointer to an object. It can't be a pointer to a function, for example.
- dpark 5mo agoAll pointers in C/C++ can point to “nothing”. Swapping “void *” for “byte *” is basically an aesthetic choice.
- throwaway27448 5mo agoRight. So why not use a typed reference?
- dpark 5mo ago1. void * is a type 2. The functions in question here operate on raw memory. void * conveys the same information as byte *. It’s not untyped vs typed. It’s two different types that convey the same information but require slightly different mechanics to obtain. 3. The author explained his reasoning for preferring void * over byte * (or uint8_t *) 4. A reference also isn’t the same thing as a pointer in C++