B
bob_jenkins
{
const void *p;
(void)memset((void *)p, ' ', (size_t)10);
}
Should this call to memset() be legal? Memset is of type
void *memset(void *, unsigned char, size_t)
Also, (void *) is the generic pointer type.
My real question is, is (void *) such a generic pointer type that it
can legally discard const? If this is legal, what is the point of
const, seeing how nobody's ever going to get warned about doing a
memset to a const string? And if this isn't legal, is there any
completely generic pointer type (one that can get const to be ignored)?
const void *p;
(void)memset((void *)p, ' ', (size_t)10);
}
Should this call to memset() be legal? Memset is of type
void *memset(void *, unsigned char, size_t)
Also, (void *) is the generic pointer type.
My real question is, is (void *) such a generic pointer type that it
can legally discard const? If this is legal, what is the point of
const, seeing how nobody's ever going to get warned about doing a
memset to a const string? And if this isn't legal, is there any
completely generic pointer type (one that can get const to be ignored)?