[ECOS] What's the meaning of those C++ code? Thanks.

Jonathan Larmour jifl@eCosCentric.com
Fri Apr 25 18:18:00 GMT 2003


[ Oops sorry, didn't see this reply when I just sent my last mail. Sorry 
bout the noise. ]

Bob Koninckx wrote:
> On Wed, 2003-04-23 at 16:18, QiangHuang wrote:
> 
>>any different between " Cyg_Mutex *m = new((void *)mutex) Cyg_Mutex; " and "
>>Cyg_Mutex *m = new((void *)mutex) Cyg_Mutex( );  "
> 
> I don't think so, I am not 100 % sure though. You are aware that these
> questions have little to do with eCos and everything with C++, are you ?

Indeed. The crux is that it's just a standard C++ thing. And the fact it 
is placement new rather than plain new makes no difference to whether new 
Cyg_Mutex or new Cyg_Mutex() is right - it's just C++.

>>it seems the "  void cyg_flag_init(){  Cyg_Flag *t = new((void *)flag)
>>Cyg_Flag();    t=t; } " (Note: Cyg_Flag( ) (with bracket)) while
>>"cyg_mutex_init( ){ Cyg_Mutex *m = new((void *)mutex) Cyg_Mutex;" m=m;} (no
>>bracket here) ?
> 
> Don't understand what you're asking here?

I think he's asking why they aren't the same. The answer is that it makes 
no difference.

Jifl
-- 
eCosCentric    http://www.eCosCentric.com/    The eCos and RedBoot experts
--[ "You can complain because roses have thorns, or you ]--
--[  can rejoice because thorns have roses." -Lincoln   ]-- Opinions==mine


-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss



More information about the Ecos-discuss mailing list