delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1992/07/17/12:08:41

Date: Fri, 17 Jul 92 16:44:01 +0100
From: popineau AT ese-metz DOT fr
To: djgpp AT sun DOT soe DOT clarkson DOT edu
Subject: g++ and overloading operator new

The Ansi C++ syntax admits the overloading of operator new in
the following way :

class X {
	...
	void *operator new(size_t s) { return (void *)malloc(s); } ;
	void *operator new(size_t, int);
	...
}

and then you can use

x = new(3) X; /* for example */

But this construct is not recognized by gcc/g++ . Does anybody
knows a (more or less) clean way to do the same job ?

I post this message  in this mailing list  as I have  no access to the
Internet News at this time.

Thanks,

F. Popineau

--
----------------------------------------------|-------------------------------|
|e-mail: popineau AT loria DOT crin DOT fr		      | "God is real ...              |
|        popineau AT ese-metz DOT fr                 |         ... unless integer ?" |
|voice-mail: (+33) 87-74-99-38                |                               |
|surface-mail: 	Ecole Superieure d'Electricite|                               |
|	      	2 rue Edouard Belin           | "If you haven't been caught   |
|		57078 Metz Cedex 3	      |      did you really do it ? " |
----------------------------------------------|-------------------------------|

- Raw text -


  webmaster     delorie software   privacy  
  Copyright 2019   by DJ Delorie     Updated Jul 2019