Boost logo

Boost :

From: Stefan Seefeld (seefeld_at_[hidden])
Date: 2005-12-08 10:48:06


Thorsten Ottosen wrote:

> is this necessary? after all, I think most function bodies would look like
>
> {
> if( foo() )
> boost::throw_exception( ... )
> ...
> // normal code here
> }

Consider this:

int process(int d)
{
   switch (d)
   {
      case 0: return process_0();
      default: THROW("unexpected argument");
   }
}

As long as THROW maps to 'throw' all is fine, but for anything else the compiler
might find that you fall through the switch block and thus issues a 'missing
return statement' warning/error.

Regards,
                Stefan


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