F
Frank A. Uepping
Hi,
look at this function, which does some low-level IO.
void writen(int fd, const void* data, size_t size)
{
while (size) {
int n = write(fd, data, size);
if (n < 0)
throw logic_error...
static_cast<const char*>(data) += n; // reinterpret_cast?
size -= n;
}
}
Here it is necessary to do a cast in order to do some pointer arithmetic.
Is the static_cast or the reinterpret_cast appropriate?
/FAU
look at this function, which does some low-level IO.
void writen(int fd, const void* data, size_t size)
{
while (size) {
int n = write(fd, data, size);
if (n < 0)
throw logic_error...
static_cast<const char*>(data) += n; // reinterpret_cast?
size -= n;
}
}
Here it is necessary to do a cast in order to do some pointer arithmetic.
Is the static_cast or the reinterpret_cast appropriate?
/FAU