Re: new/delete overloading, why?

From: Amos Jeffries <squid3_at_treenet.co.nz>
Date: Sun, 22 Aug 2010 17:18:35 +1200

Henrik Nordström wrote:
> lör 2010-08-21 klockan 20:26 +1200 skrev Amos Jeffries:
>> Henrik Nordström wrote:
>>> lör 2010-08-21 klockan 07:02 +1200 skrev Robert Collins:
>>>
>>>> it was to stop crashes with code that had been cast and was freed with
>>>> xfree(); if you don't alloc with a matching allocator, and the
>>>> platform has a different default new - *boom*.
>>> Allocating with new and freeing with free() is a coding error in all
>>> books.
>>>
>>>> There may be nothing like that left to worry about now.
>>> I sure hope not.
>>>
>> valgrind reports it as an error. I think I recall seeing gcc 4.3+ report
>> it as a warning which we catch with -Werror. The older ones (ala gcc 2.*
>> and 3.* did not AFAIK, thus the high potential for flashing lights and
>> sound effects).
>
> So you argree that there should be nothing like that left to worry
> about?

I'm torn both ways.

We should add a small compiler unit-test into configure for a while
before removing either way. No guess work then.

Amos

-- 
Please be using
   Current Stable Squid 2.7.STABLE9 or 3.1.6
   Beta testers wanted for 3.2.0.1
Received on Sun Aug 22 2010 - 05:18:43 MDT

This archive was generated by hypermail 2.2.0 : Mon Aug 23 2010 - 12:00:05 MDT