This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Inside eCos : the new operator
- To: "Ecos-List (E-mail)" <ecos-discuss at sourceware dot cygnus dot com>
- Subject: [ECOS] Inside eCos : the new operator
- From: Fabrice Gautier <Fabrice_Gautier at sdesigns dot com>
- Date: Fri, 18 Aug 2000 17:29:05 -0700
Hi,
While trying to find answers to some of my questions I came accross this
code:
(in kernel/current/src/common/kapi.cxx. line ~370)
Cyg_Interrupt *t = new((void *)intr) Cyg_Interrupt (
(cyg_vector)vector,
(cyg_priority)priority,
(CYG_ADDRWORD)data,
(cyg_ISR *)isr,
(cyg_DSR *)dsr );
t=t;
CYG_CHECK_DATA_PTR( handle, "Bad handle pointer" );
*handle = (cyg_handle_t)intr;
The "t=t;" line is the most surprising to me but the syntax of the new
operator seems very interresting too.
I'm wondering what is the behaviour of the new operator in a C++ eCos
program?
Can it do dynamic allocation?
What will happen in the above 'new' call if intr is a Null pointer?
Does the gcc patch required to compile it explain all that?
Are the 't' variable and the "t=t;' line just a way to bluff the compiler?
Thanks
A+
--
Fabrice Gautier
fabrice_gautier@sdesigns.com