Menu

#23 Improve exception safety with smart pointers

closed
nobody
None
5
2015-10-15
2015-10-13
No

Would you like to wrap any pointer data members with the template class "std::unique_ptr"?

Discussion

  • Ulya Trofimovich

    re2c tries to be C++98 compatible.

     
    • Markus Elfring

      Markus Elfring - 2015-10-14

      How do you think about to reuse the approach by Howard E. Hinnant eventually?

       
  • Ulya Trofimovich

    • status: open --> closed
     
  • Ulya Trofimovich

    Honestly, I don't understand where in partucular you want to use 'std::unique_ptr'. What pointers should be wrapped in it and why? (You said "any pointer data members", but this seems a really strange thing to do).

     
    • Markus Elfring

      Markus Elfring - 2015-10-15
       
  • Ulya Trofimovich

    I prefere to solve memory management problems by using global custom allocator (memory pool, erena, whatever you call it). re2c makes a lot of small allocations/deallocations. Checking for failure in some few cases is a bad idea.

     
    • Markus Elfring

      Markus Elfring - 2015-10-15

      How should your software react if the exception "std::bad_alloc" will eventually be thrown during the construction for an object of the class like "CharSet"?

       
  • Ulya Trofimovich

    Fail? No memory ---- no DFAs. :)

     

Log in to post a comment.