Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

What is warning number C4238?

114 views
Skip to first unread message

Chuck Le Mieux

unread,
Oct 24, 1997, 3:00:00 AM10/24/97
to

Found the following on Microsofts Visual C++ Technical Support.

Compiler Warning (level 4) C4238
nonstandard extension used : class rvalue used as lvalue
This error occurs when you are using Microsoft language extensions (/Ze) and
use a class type as is an rvalue in a context that implicitly or explicitly
takes its address. For example:
struct C
{
C();
};
C * pC = &C(); // yields C4238
This usage is not permitted by the C++ Working Paper, and in some cases
(such as the example above) can be quite dangerous. This usage is being
permitted under /Ze for compatibility with previous versions of the
compiler, which did not flag this error. This usage is not permitted under
/Za.


--
You can also reach me at the following
clem...@rocketmail.com
Voice Mail and Fax
504.673.3062
http://www.tou.com/host/OOC32/

Thomas Blenkers wrote in message
<3450AB49...@anachem.ruhr-uni-bochum.de>...
>Hello out there,
>
>following you find a sniplet of my code for painting an owner drawn list
>control inside a MFC-CListCrtl-derived class having the ingenious name
>CMyListCrtl ;)
>
>
>void CMyListCrtl::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
>{
> CDC* pDC = CDC::FromHandle(lpDrawItemStruct->hDC);
> int nItem = lpDrawItemStruct->itemID;
> CRect rcHighlight;
> GetItemRect(nItem, rcHighlight, LVIR_LABEL);
>
> // The next line causes warning C4238
> pDC->FillRect(rcHighlight, &CBrush(::GetSysColor(COLOR_HIGHLIGHT)));
>}
>
>Compiling this code with MSVC 5.0 in release mode and warning level 4 I
>get a warning with the number C4238: non-standard-extension R-value
>used as L-value (I have the german version, so I'm sure the exact phrase
>is slightly different).
>
>What have I done, and what should be done better?
>
>Feel free to post and mail your answers.
>
>WM_THANKSALOT
> Thomas Blenkers

0 new messages