This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: What's the meaning of those C++ code? Thanks.


QiangHuang wrote:

so when declares:


cyg_mutex_t mutex1;
cyg_mutex_init(&mutex1);

what's the meaning of  "(1). Cyg_Mutex *m = new((void *)mutex) Cyg_Mutex;
(2). m=m;"  here? Thanks a lot.

It's a construct called placement new. e.g. http://www.parashift.com/c++-faq-lite/dtors.html#faq-11.10


m=m avoids an "unused variable" warning, that's all.

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]