[Boost-bugs] [Boost C++ Libraries] #7361: Forbid compilation of leaking mistake.

Subject: [Boost-bugs] [Boost C++ Libraries] #7361: Forbid compilation of leaking mistake.
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2012-09-10 17:26:09


#7361: Forbid compilation of leaking mistake.
-------------------------------+--------------------------------------------
 Reporter: mjklaim@… | Owner: vladimir_prus
     Type: Support Requests | Status: new
Milestone: To Be Determined | Component: program_options
  Version: Boost 1.51.0 | Severity: Problem
 Keywords: |
-------------------------------+--------------------------------------------
 I was adding program_option to my prorgam when I discovered a related
 leak. Fortunately it was false positive, but it pointed a hidden problem.
 I used:
  - Visual Studio 2012
  - Boost 1.51.0
  - Visual Leak Detector to detect the leak

 This, generate the leak:


 {{{
 #include <boost/program_options.hpp>

 int main()
 {
         namespace bpo = boost::program_options;
         bpo::options_description options( "Options" );
         options.add_options()
                         ( "test" , "Test." )
                 , ( "value" , bpo::value<int>(),
 "Value." )
                 ;


 }
 }}}


 The second option is leaking. The reason is because of the comma in the
 beginning of the line.
 I first added it by reflex when using function arguments so it took me
 some time to find what was leaking.
 Part of the time I spend was figuring out why it don't leak if you don't
 set a value type:

 {{{

 #include <boost/program_options.hpp>

 int main()
 {
         namespace bpo = boost::program_options;
         bpo::options_description options( "Options" );
         options.add_options()
                         ( "test" , "Test." )
                 , ( "value" , "Value." ) // no leak
 but still wrong!
                 ;

 }

 }}}

 The main problem I see with this is that it is compiled without any
 problem nor warning.

 So here is my question:
 Would it be possible to forbid comma operator with
 options_description_easy_init?

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/7361>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:10 UTC