J
Jim Langston
In my code I have this line:
CloseOnOpenNotifier.notifyObservers( dynamic_cast<Argument*>(
&OpenArgument( NotifyMsg ) ) );
which I'm getting a warning on in VC++ .net 2003 when I set the warning
level to 4.
c:\Source\Abyssal\source\Abyssal\CGUIElement.cpp(184) : warning C4238:
nonstandard extension used : class rvalue used as lvalue
NotifyMsg is an int.
OpenArgument is a simple class with a constructor:
class OpenArgument: public Argument
{
public:
int Msg;
OpenArgument( int NotifyMsg ): Msg( NotifyMsg ) {}
};
notifyObservers
is a method of OpenArgument that takes an argument pointer:
void notifyObservers(Argument* arg = 0)
{
Observable::notifyObservers( arg );
};
I don't see where the lvalue is in my code though. My only thinking is that
OpenArgument() is a temporary object which I'm taking the address off and
passing it to a method which may somehow be unstandard.
I know that the OpenArgument temp will only have the lifetime of that one
line, which is fine with me. I'm just building it to pass the NotifyMsg to
the method.
Any suggestions? I know that if I created a varaible for OpenArgument
before this and passed the address of that the warning would probably go
away:
OpenArgument TempArg( NotifyMsg );
CloseOnOpenNotifier.notifyObservers( dynamic_cast<Argument*>( &TempArg ) );
but that adds a temp and a line to my code which I really don't need, IMO.
CloseOnOpenNotifier.notifyObservers( dynamic_cast<Argument*>(
&OpenArgument( NotifyMsg ) ) );
which I'm getting a warning on in VC++ .net 2003 when I set the warning
level to 4.
c:\Source\Abyssal\source\Abyssal\CGUIElement.cpp(184) : warning C4238:
nonstandard extension used : class rvalue used as lvalue
NotifyMsg is an int.
OpenArgument is a simple class with a constructor:
class OpenArgument: public Argument
{
public:
int Msg;
OpenArgument( int NotifyMsg ): Msg( NotifyMsg ) {}
};
notifyObservers
is a method of OpenArgument that takes an argument pointer:
void notifyObservers(Argument* arg = 0)
{
Observable::notifyObservers( arg );
};
I don't see where the lvalue is in my code though. My only thinking is that
OpenArgument() is a temporary object which I'm taking the address off and
passing it to a method which may somehow be unstandard.
I know that the OpenArgument temp will only have the lifetime of that one
line, which is fine with me. I'm just building it to pass the NotifyMsg to
the method.
Any suggestions? I know that if I created a varaible for OpenArgument
before this and passed the address of that the warning would probably go
away:
OpenArgument TempArg( NotifyMsg );
CloseOnOpenNotifier.notifyObservers( dynamic_cast<Argument*>( &TempArg ) );
but that adds a temp and a line to my code which I really don't need, IMO.