Conditional operator successfully compiled in windows but gives error in
Linux
Please help me reason out for the error I am getting with this statement,
in Linux environment.
p_pAphErrorMessage->getSvc()?l_AphUpdateMessage->setSvc(p_pAphErrorMessage->getSvc()):0;
p_pAphErrorMessage->getObj()?l_AphUpdateMessage->setObj(p_pAphErrorMessage->getObj()):0;
This code is successfully compiled in windows but its giving error in
Linux enviroment.
src/aph.cpp:7320: error:
âl_AphUpdateMessage->AphMessage::setSvc(((AphUpdateMessage*)p_pAphErrorMessage)->AphUpdateMessage::<anonymous>.AphFidValuesMessage::<anonymous>.AphMessage::getSvc())â
has type âvoidâ and is not a throw-expression
src/aph.cpp:7321: error:
âl_AphUpdateMessage->AphMessage::setObj(((AphUpdateMessage*)p_pAphErrorMessage)->AphUpdateMessage::<anonymous>.AphFidValuesMessage::<anonymous>.AphMessage::getObj())â
has type âvoidâ and is not a throw-expression
I investigated this a bit and suspect returning 0; could be the reason for
it. Can we use conditional operator in such a way to use it just for if
not for else, eg,
c= a?a:/*DO NOTHING*/;
But, this way I am not getting any success in compilation. Any other
recommended way to achieve it.
No comments:
Post a Comment