4 ms·
Start as void*, current and/or end as size_t offsets from start is common. The opposite way round works too, use a void* for end and current and/or end as offs
by JonChesterfield 3y ago
Start as void*, current and/or end as size_t offsets from start is common.
The opposite way round works too, use a void* for end and current and/or end as offsets from that. 64 bit pointer and two 32 bit offsets might appeal on x64.
Without working through the arithmetic now I'd expect storing (size-current)=remaining instead of current to work well for the out of space check.