This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: What's the meaning of those C++ code? Thanks.
- From: Jonathan Larmour <jifl at eCosCentric dot com>
- To: QiangHuang <jameshq at liverpool dot ac dot uk>
- Cc: ecos-discuss at sources dot redhat dot com
- Date: Fri, 25 Apr 2003 19:13:11 +0100
- Subject: Re: [ECOS] What's the meaning of those C++ code? Thanks.
- References: <ONEOIJPPOKNBBKJKCGLCCEFLCAAA.jameshq@liv.ac.uk>
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