Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Placement operator new/delete question

Reply
Thread Tools

Placement operator new/delete question

 
 
Ioannis Vranos
Guest
Posts: n/a
 
      10-16-2004
Ioannis Vranos wrote:

> I want to mention here, that the code is a demonstration only, and does
> not really work reliably for more than one objects.
>
>
> In summary there are two cases of placement operator new and delete:
>
> 1) Global placement new, new[], delete, and delete[].
>
> 2) Class-oriented member functions placement new, new[], delete and
> delete[].
>
>
> The last are also implicitly called as the globals.



Also an additional distinction here. The ones used in the example, are
explicit user definitions of operators new and delete in the member
function call.


"Placement operators new/new[]/delete/delete[]" the ones used in the style

SomeClass *p=new(somepointer) SomeClass;


have the signatures and form:

void* operator new (size_t, void* p) throw() { return p; }

void operator delete (void* p, void*) throw() { }

void* operator new[](size_t, void* p) throw() { return p; }

void operator delete[](void* p, void*) throw() { }



--
Ioannis Vranos

http://www23.brinkster.com/noicys
 
Reply With Quote
 
 
 
 
Ioannis Vranos
Guest
Posts: n/a
 
      10-16-2004
Ioannis Vranos wrote:

>> Oh, placement _operator_ delete. When people refer to "placement new"
>> they're usually referring to what the standard calls a "new expression"
>> (e.g. new (pointer) Type()), and not operator new, so I assumed you were
>> referring to some unusual "delete expression".

>
>
>
>
> As far as I know this is the default global placement operator new,
> without an explicit user-definition.




What I said applies. And a user can define his own versions of placement
operators.

However the ones I use in my code example lower in the thread, are
user-defined simple operators new and delete, not the "placement" ones.



--
Ioannis Vranos

http://www23.brinkster.com/noicys
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
VHDL language question regarding placement of attributes KJ VHDL 2 09-22-2006 09:07 PM
Indirection operator placement Marty C++ 5 08-21-2006 06:26 PM
Passing address of stack memory to placement new operator mangesh C++ 15 06-30-2006 06:01 PM
overriding operator new and accessing placement new Mark P C++ 6 04-27-2005 04:17 AM
dynamic data grid placement question =?Utf-8?B?UGF1bA==?= ASP .Net 6 10-21-2004 06:15 PM



Advertisments