Boost logo

Boost :

Subject: Re: [boost] [Boost.Breakable] Any interest in a Boost Breakable library?
From: Michael Caisse (boost_at_[hidden])
Date: 2009-09-07 01:43:07


Pierre Morcello wrote:
> Breakable
> {
> if(!filestream.bad())
> {
> log("error at opening file");
> break;
> }
>
> if(!filestream.good())
> {
> log("error inside the file (eof)");
> break;
> }
>
> if(!xmlLoadFrom(filestream))
> {
> log("the file is no xml document.");
> break;
> }
>
> // and so on, to test if the xml is valid, etc...
> }
>
>

And why not just add the else?

  if(!filestream.bad())
  {
     log("error at opening file");
  }
  else if(!filestream.good())
  {
     log("error inside the file (eof)");
  }
  else if(!xmlLoadFrom(filestream))
  {
     log("the file is no xml document.");
  }

-- 
----------------------------------
Michael Caisse
Object Modeling Designs
www.objectmodelingdesigns.com

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