Article View: es.comp.lenguajes.c++
Article #16212About placement syntax
From: Rafael Corchuelo Gil
Date: Fri, 13 Dec 1996 00:00
Date: Fri, 13 Dec 1996 00:00
81 lines
3818 bytes
3818 bytes
Hello,
I am trying to overload the new operator using the placement syntax.
It is, the class I am developing is similar to this one:
class Foo {
public:
Foo()
{
// do something (1)
}
void * operator new(size_t size, Arena *arena)
{
// Allocate memory for size bytes in arena
}
}
I have overloaded new this way because when I create a new object
I want to tell the memory management system where the object has to be
allocated. So, I want to write something like this:
Foo *f = new(my_arena) Foo();
But when I try to compile this class, my compiler reports an
error message at (1): "wrong number of arguments in call to operator
new(unsigned int, Arena *)".
Could some one, please, tell me about what I am doing wrong?
I have read "The C++ programming Language" 2nd Ed., but I haven't found a
solution.
Even more, my compiler allows a constructor like:
class Bar{
public:
Bar(char *)(float)(int) ... (float *, int **)
{
}
}
Could you, please, explain me what this syntax means, or tell
me where I can find the information I need?
Thank you very much, indeed.
P.S.: Please, e-mail me and I will post the responses to this newsgroup.
--
+------------------------------------------+-----------------------------------+
! ! !
! A. Rafael Corchuelo Gil ! !
! ! !
! corcho@obelix.cica.es ! ("`-''-/").___..--''"`-._
! www.lsi.us.es:8080/~corchu/corchu.html ! `6_ 6 ) `-. ( ).`-.__.`)
+------------------------------------------+ (_Y_.)' ._ ) `._ `. ``-..-'
! ! _..`--'_..-_/ /--'_.' ,' !
! -Cousin, tu peux lire, mais il fait nuit ! (il),-'' (li),' ((!.-' !
! -Ah!... Il fait nuit... ! !
! ! !
! Cyrano. Edmond Rostand ! !
+------------------------------------------+-----------------------------------+
--
+------------------------------------------+-----------------------------------+
! ! !
! A. Rafael Corchuelo Gil ! !
! ! !
! corcho@obelix.cica.es ! ("`-''-/").___..--''"`-._
! www.lsi.us.es:8080/~corchu/corchu.html ! `6_ 6 ) `-. ( ).`-.__.`)
+------------------------------------------+ (_Y_.)' ._ ) `._ `. ``-..-'
! ! _..`--'_..-_/ /--'_.' ,' !
! -Cousin, tu peux lire, mais il fait nuit ! (il),-'' (li),' ((!.-' !
! -Ah!... Il fait nuit... ! !
! ! !
! Cyrano. Edmond Rostand ! !
+------------------------------------------+-----------------------------------+
Technical Details
Message-ID:
<58ru92$icl@erika.cica.es>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f53ec,83f74f4101582a07,start X-Google-Attributes: gidf53ec,public From: corcho@obelix.cica.es (Rafael Corchuelo Gil) Subject: About placement syntax Date: 1996/12/13 Message-ID: <58ru92$icl@erika.cica.es> X-Deja-AN: 204233932 content-type: text/plain; charset=iso-8895-1 organization: Centro Informatico Cientifico de Andalucia mime-version: 1.0 newsgroups: es.comp.lenguajes.c++