Hacker News new | ask | show | jobs
by ncmncm 1646 days ago
Hint: nobody uses "new" in C++ anymore. All the C++ containers, and make_unique etc. know how to use local arenas.

I gather there has been some effort to get Rust library components aware of such things. Handling exhaustion in them is an interesting research topic.

1 comments

> Hint: nobody uses "new" in C++ anymore

"nobody"

    ~/chromium (main)$ rg --stats -t cpp "[=\(][ ]*new "    
    ...
   
    17639 matches
    17536 matched lines
    7162 files contained matches
    96561 files searched
    1539692 bytes printed
    763109193 bytes searched
    1.119265 seconds spent searching
    1.428974 seconds
That's surely a lot of non-usage. Maybe it's just Chrome, though?

    ~/llvm-project (main)$ rg --stats -t cpp "[=\(][ ]*new "
    ...
    7447 matches
    7394 matched lines
    2245 files contained matches
    35148 files searched
    541938 bytes printed
    385115019 bytes searched
    0.425689 seconds spent searching
    0.485431 seconds
Hmmmm.
You have found lots of old code.

... which we already knew existed.