Boost logo

Boost :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2004-11-23 02:34:33


Hi Jody,

>
>
> /home/jody/boost_1_32_0/libs/program_options/src/cmdline.cpp: In member
> function `void
> boost::program_options::detail::cmdline::clear_error()':
> /home/jody/boost_1_32_0/libs/program_options/src/cmdline.cpp:732:
> warning: `
> boost::program_options::invalid_command_line_syntax::kind_t re' might
> be
> used uninitialized in this function
>
> In this case, the enumeration "re" of type kind_t is not initialized,
> and will hold "any" value. The switch does not set the value in the
> default section, and then an exception is thrown with the uninitialized
> "re" variable.

The problem is that gcc is too smart. Switch does not handle a single
enumerator --- 'ed_success', very reasonable. It's handled before the
switch. Even if I add 'ed_success' case, it still report the warning.

So, I've worked this around by adding 'return' in default case. The change
is committed.

Thanks for the report,
Volodya


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk