This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
question about "new" overloading function
- From: "Tony Ko" <nhko at gctsemi dot com>
- To: <ecos-discuss at sources dot redhat dot com>
- Date: Wed, 6 Mar 2002 20:46:28 +0900
- Subject: [ECOS] question about "new" overloading function
Hi.
Look at code below, this code is from kapi.cxx.
// ---------------------------------------------------------------------
----
// Magic new function
inline void *operator new(size_t size, void *ptr)
{
CYG_CHECK_DATA_PTR( ptr, "Bad pointer" );
return ptr;
}
// ---------------------------------------------------------------------
----
/*----------------------------------------------------------------------
-----*/
/* Thread operations */
externC void cyg_thread_create(
cyg_addrword_t sched_info, /* scheduling info (eg
pri) */
cyg_thread_entry_t *entry, /* entry point function
*/
cyg_addrword_t entry_data, /* entry data
*/
char *name, /* optional thread name
*/
void *stack_base, /* stack base, NULL =
alloc */
cyg_ucount32 stack_size, /* stack size, 0 =
default */
cyg_handle_t *handle, /* returned thread
handle */
cyg_thread *thread /* put thread here
*/
)
{
CYG_ASSERT_SIZES( cyg_thread, Cyg_Thread );
Cyg_Thread *t = new((void *)thread) Cyg_Thread (
(CYG_ADDRWORD) sched_info,
(cyg_thread_entry *)entry,
(CYG_ADDRWORD) entry_data,
name,
(CYG_ADDRWORD) stack_base,
stack_size
);
t=t;
CYG_CHECK_DATA_PTR( handle, "Bad handle pointer" );
*handle = (cyg_handle_t)thread;
}
I wonder about HOW this "new" operate.
thanks in advance.
Tony (Nohi Ko)
_ _
GCT, Goodmorning Tower,Youido,Seoul,Korea. Tel:+82-2-2167-1283
Mobile : 016-368-7742 URL: www.gctsemi.com
You already possess everything necessary to become great. Crow
--
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss