This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: cyg_create_thread question
On October 29, 2004 06:06 am, Andrew Lunn wrote:
> On Fri, Oct 29, 2004 at 06:00:19AM -0400, Stephan Bourduas wrote:
> > This is more of a C/C++ question. Can someone tell me
> > exactly what "new((void *)thread)" thread does? The code
> > is taken from kapi.cxx.
>
> The normal usage of new is that it allocated the memory for the object
> on the heap. This usage you pass the memory for the object to new.
>
> Andrew
Quick followup question: Why is "thread" being cast to a void pointer? I did
some playing around and reading up on "placement new" and I found no
requirement to cast to (void *). A simple example I found was:
int* x = new int;
int* y = new(x) int(1);
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss