passing a (const void *) into memset()
bob_jenkins_at_burtleburtle.net
Date: 01/28/05
- Next message: E. Robert Tisdale: "Re: passing arg char[X][Y] to function expecting (char**)"
- Previous message: Keith Thompson: "Re: What is the difference between signed and unsigned char?"
- Next in thread: Ben Pfaff: "Re: passing a (const void *) into memset()"
- Reply: Ben Pfaff: "Re: passing a (const void *) into memset()"
- Reply: Eric Schmidt: "Re: passing a (const void *) into memset()"
- Reply: Mike Wahler: "Re: passing a (const void *) into memset()"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 27 Jan 2005 15:42:25 -0800
{
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)?
- Next message: E. Robert Tisdale: "Re: passing arg char[X][Y] to function expecting (char**)"
- Previous message: Keith Thompson: "Re: What is the difference between signed and unsigned char?"
- Next in thread: Ben Pfaff: "Re: passing a (const void *) into memset()"
- Reply: Ben Pfaff: "Re: passing a (const void *) into memset()"
- Reply: Eric Schmidt: "Re: passing a (const void *) into memset()"
- Reply: Mike Wahler: "Re: passing a (const void *) into memset()"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|