Re: warning C4238 : cast reference in void*
- From: Ulrich Eckhardt <eckhardt@xxxxxxxxxxxxxx>
- Date: Thu, 02 Nov 2006 12:40:45 +0100
Eric wrote:
void foo(void* param)[...]
foo((void*) &szWord); //give C4238 warning : nonstandard extension
used : class rvalue used as lvalue
1. For your own sake, forget about the fact that C-style casts like the
above exist. I haven't found the need for one in over 1M lines of code and
you surely don't have such a case here.
Conversion from a typed pointer to a void pointer is implicitly done by the
compiler, so a cast isn't necessary. If you absolutely want, use a
static_cast, which is also the right cast to convert to a typed pointer
again.
2. Igor already mentioned it, this can't be the code you tried to compile,
please show the real code for an analysis of its problems.
Uli
.
- Follow-Ups:
- Re: warning C4238 : cast reference in void*
- From: Eric
- Re: warning C4238 : cast reference in void*
- References:
- warning C4238 : cast reference in void*
- From: Eric
- warning C4238 : cast reference in void*
- Prev by Date: Re: const ref vs. pointer
- Next by Date: inserting data into sub items using LVITEM
- Previous by thread: Re: warning C4238 : cast reference in void*
- Next by thread: Re: warning C4238 : cast reference in void*
- Index(es):
Relevant Pages
|