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]

Inside eCos : the new operator


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 





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