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]

Re: Shouldn't stringstream ONLY use the allocator object?


On Fri, May 11, 2001 at 04:12:07PM -0700, Nathan Myers wrote:
> The answer has to be something like: if it's doing a string-like
> operation, it should use the allocator; if it's doing an iostream-like
> operation, it should use op new or something else.  In practice
> this probably means that it should use the allocator only for the
> string buffer.

Thanks - this answer my uncertainty about whether or not I could
expect a change in libstdc++ in the future.  It doesn't solve my
problem however :(.
 
Nevertheless, I think that in principle it wouldn't be a "bad thing"
to disallow "user space" allocations during debug output - based
on the fact that debug output (the whether or not it is written)
shouldn't have influence on the functionality of an application
and allocating memory does imho.
 
Therefore, what is left to solve is "confusion" on the side of
the user when he does something like this:
 
#ifdef CWDEBUG
  char* p;
  Dout(dc::notice, (p = strdup(foo()) << ": You should pass an argument to " << p);
  delete p;
#endif
 
(hopefully this code speaks for itself)
 
which would give an error at 'delete p' because the strdup is done as 'internal'
allocation and can not be found back in the memory allocation administration.

Sorry for thinking out loud, off topic, for this list :*)

-- 
Carlo Wood <carlo@alinoe.com>


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