[comp.lang.c++] Overloading New & Delete, also const

pjmp@hrc63.co.uk (Peter Polkinghorne) (05/07/87)

This is a repost of the first question (since there was no response) with an
additional question on consts. We are using v1.1 on Sun 3.2.

According to the book reference manual section 8.5.11 (page  282) both
new & delete can be overloaded. However having done this, I discover that
c++ (or cfront) fails to use the new operators. I can see that this is
reasonable for new which is really a "zero-ary" operator :-), but delete
is a perfectly normal unary operator.

Now having investigated this, I also realise I should use the contructor
destructor mechanism for defining my own freestore mechanism. So is the
inability to overload new & delete a feature or a bug?

The const feature seems to be oddly implemented, since they are GLOBAL
variables, not even static. Hence advice in the manual to have const in
header files, gives errors with ld (sect 4.3 page 107) of multiply defined
variables. Also const does not work in case labels. Are these problems
fixed in 1.2?

Peter Polkinghorne	pjmp@uk.co.gec-rl-hrc or ...!mcvax!ukc!gec-rl-hrc!pjmp
GEC Research
Wembley			"His intimate friends called him 'candle-ends',
UK			and his enemies 'toasted-cheese'" - Lewis Carroll