This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC 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: using C++ STL containers in GCC/gfortran source code


On 12/17/2016 01:07 PM, Jonathan Wakely wrote:
> On 17 December 2016 at 12:28, Pedro Alves wrote:
>> On 12/17/2016 12:23 PM, Jonathan Wakely wrote:
>>> Instead of replacing the global new operator we could write a custom
>>> allocator that uses xmalloc, and we can have e.g. gcc::string as a
>>> typedef for std::basic_string<char, std::char_traits<char>,
>>> gcc::xmallocator<char>>
>>>
>>
>> That doesn't make sense to me, as it leaves the problem
>> with all "new" expressions that call global op new in
>> the codebase, like I mentioned?  (And you'd have to do that
>> for all containers that you'd want to use.)
>>
>> Am I missing something?
> 
> Nope, it doesn't help that. I don't know if people use new in the GCC
> code base, or if we want them to be able to.

Seems to me they do:

 $ grep " = new " gcc/ -rn | grep -v "testsuite/" | wc -l
 1000

Several of those hit class-specific new, a few placement-new,
but seems to me most will be hitting global new.

Thanks,
Pedro Alves


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