IDL4-CPP 1.0b2 FTF Avatar
  1. OMG Issue

IDL4CPP — std::shared_ptr should be passed by value

  • Key: IDL4CPP-50
  • Status: closed  
  • Source: Remedy IT ( Johnny Willemsen)
  • Summary:

    The spec in 7.4 says that only basic types/enum should be passed by value for an in argument, but that should also include all shared_ptr types, see https://herbsutter.com/2013/06/05/gotw-91-solution-smart-pointer-parameters/ for some information (more can be found on the internet).

  • Reported: IDL4-CPP 1.0b1 — Fri, 2 Feb 2024 13:36 GMT
  • Disposition: Deferred — IDL4-CPP 1.0b2
  • Disposition Summary:

    Passing shared_ptr by value could introduce certain issues

    If we pass by value we could introduce certain issues, like locking (having to increase the reference counter). It's unclear to us whether this would be beneficial. If we pass it by const reference, we're guaranteeing that the object won't be destroyed until the end of the function.

    After a discussion within the IDL WG, we agreed on leaving the mapping as it currently is and reevaluate improvements to the mapping in future RTFs.

  • Updated: Mon, 16 Sep 2024 14:15 GMT