D
Dave Theese
In Loki (smartptr.h), I've noticed the following expression occurring by
itself:
(void)val;
What is the purpose in casting something to void, especially in a
stand-alone expression such as this and not as part of something larger?
I'm surprised this is possible as it is not possible to declare a variable
of type void. And I'm intrigued to learn the purpose...
Here's the context I see this in:
static void OnDereference(P val)
{ assert(val); (void)val; }
BTW, I see this in the VC++ port of Loki. I don't know if it's in the
original Loki or not...
Thanks,
Dave
itself:
(void)val;
What is the purpose in casting something to void, especially in a
stand-alone expression such as this and not as part of something larger?
I'm surprised this is possible as it is not possible to declare a variable
of type void. And I'm intrigued to learn the purpose...
Here's the context I see this in:
static void OnDereference(P val)
{ assert(val); (void)val; }
BTW, I see this in the VC++ port of Loki. I don't know if it's in the
original Loki or not...
Thanks,
Dave