This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: pool allocator changes and delete[] void*


Paolo Carlini <pcarlini@suse.de> writes:

| Gerald Pfeifer wrote:
| 
| >I'm afraid the recent pool allocator changes are causing troubles (or
| >at least tons of warnings):
| >
| >   /gcc-current/bin/../lib/gcc/$platform/3.4.0/../../../../
| >   include/c++/3.4.0/ext/pool_allocator.h:320:
| >   warning: deleting `void*' is undefined
| >
| Right Gerald. Please consider that this is work in progress: at least the
| signature of __pool_alloc::deallocate should be changed, consistently with
| that prescribed for class allocator by the Standard (20.4.1).
| 
| For now, I think you can safely suppress annoying warnings with
| the attached.
| 
| Paolo.
| 
| //////////
| 
| --- pool_allocator.h.orig	2003-12-26 15:05:17.000000000 +0100
| +++ pool_allocator.h	2003-12-26 15:22:51.000000000 +0100
| @@ -317,7 +317,7 @@
|      __pool_alloc<__threads, __inst>::deallocate(void* __p, size_t __n)
|      {
|        if ((__n > (size_t) _S_max_bytes) || (_S_force_new > 0))
| -	delete [] __p;
| +	delete [] static_cast<char*>(__p);

Please don't write that.  Say what you mean: Call the deallocation *function*

    operator delete[] (p);

-- Gaby


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]