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: [PATCH] Slightly better way to __USE_MALLOC


> You are compiling some objects with the macro and some without, I
> presume.  If you could post it (or send it to me directly), I'll see
> what I can do about it.

OK, you said that you had an example, but this is exactly what we want
to avoid (by catching at compile-time):

//a.C
#include <list>

void foo (std::list<int>& a)
{
  a.pop_back ();
}

//b.C
#include <list>

void foo (std::list<int>& a);

int main (void)
{
  std::list<int> a;

  a.push_back (1);

  foo (a);
}

(with library headers edited to remove the #error I added)
S rittle@latour; /usr/local/beta-gcc/bin/g++ -O2 -c -D__USE_MALLOC  a.C 
S rittle@latour; /usr/local/beta-gcc/bin/g++ -O2 b.C a.o
S rittle@latour; a.out
a.out in free(): warning: modified (chunk-) pointer

Other systems will crash@run-time with or without that helpful
message...

Regards,
Loren


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