[Dune-devel] [Dune-Commit] [Commit] dune-common - fb7cb2c: [cleanup] Replace or and not by || and !.

Carsten Gräser graeser at mi.fu-berlin.de
Sun Mar 15 15:30:07 CET 2015


Hi Christoph,
could you explain in which sense using ||, &&, and ! instead
of 'or', 'and', and 'not' can be considered a 'cleanup'?
The latter are perfectly valid C++ and supported by any
conforming C++ compiler.

Best,
Carsten


Am 15.03.2015 um 12:26 schrieb Christoph Grüninger:
> New commit, appeared at Sun Mar 15 12:26:41 2015 +0100
> as part of the following ref changes:
> 
>     branch refs/heads/master    updated from 826a38d -> fb7cb2c
> 
> Browsable version: http://cgit.dune-project.org/repositories/dune-common/commit/?id=fb7cb2c8b9987cbb52a9537d83548a04f4d69020
> 
> ======================================================================
> 
> commit fb7cb2c8b9987cbb52a9537d83548a04f4d69020
> Author: Christoph Grüninger <gruenich at dune-project.org>
> Date:   Sun Mar 15 11:12:37 2015 +0100
> 
>     [cleanup] Replace or and not by || and !.
> 
>  dune/common/parametertree.cc       | 6 +++---
>  dune/common/parametertree.hh       | 2 +-
>  dune/common/parametertreeparser.cc | 4 ++--
>  3 files changed, 6 insertions(+), 6 deletions(-)
> 
> 
> 
> diff --git a/dune/common/parametertree.cc b/dune/common/parametertree.cc
> index 1540106..f6623d3 100644
> --- a/dune/common/parametertree.cc
> +++ b/dune/common/parametertree.cc
> @@ -117,7 +117,7 @@ std::string& ParameterTree::operator[] (const std::string& key)
>  
>    if (dot != std::string::npos)
>    {
> -    if (not (hasSub(key.substr(0,dot))))
> +    if (! hasSub(key.substr(0,dot)))
>      {
>        subs_[key.substr(0,dot)];
>        subKeys_.push_back(key.substr(0,dot));
> @@ -127,7 +127,7 @@ std::string& ParameterTree::operator[] (const std::string& key)
>    }
>    else
>    {
> -    if (not (hasKey(key)))
> +    if (! hasKey(key))
>        valueKeys_.push_back(key);
>      return values_[key];
>    }
> @@ -144,7 +144,7 @@ const std::string& ParameterTree::operator[] (const std::string& key) const
>    }
>    else
>    {
> -    if (not (hasKey(key)))
> +    if (! hasKey(key))
>        DUNE_THROW(Dune::RangeError, "Key '" << key
>          << "' not found in ParameterTree (prefix " + prefix_ + ")");
>      return values_.find(key)->second;
> diff --git a/dune/common/parametertree.hh b/dune/common/parametertree.hh
> index 081669d..2b0d69e 100644
> --- a/dune/common/parametertree.hh
> +++ b/dune/common/parametertree.hh
> @@ -253,7 +253,7 @@ namespace Dune {
>        T dummy;
>        s >> dummy;
>        // now extraction should have failed, and eof should be set
> -      if(not s.fail() or not s.eof())
> +      if ((! s.fail()) || (! s.eof()))
>          DUNE_THROW(RangeError, " as a " << className<T>());
>        return val;
>      }
> diff --git a/dune/common/parametertreeparser.cc b/dune/common/parametertreeparser.cc
> index 106d53a..8e1963d 100644
> --- a/dune/common/parametertreeparser.cc
> +++ b/dune/common/parametertreeparser.cc
> @@ -98,13 +98,13 @@ void Dune::ParameterTreeParser::readINITree(std::istream& in,
>          if (value.length()>0)
>          {
>            // handle quoted strings
> -          if ((value[0]=='\'')or (value[0]=='"'))
> +          if ((value[0]=='\'') || (value[0]=='"'))
>            {
>              char quote = value[0];
>              value=value.substr(1);
>              while (*(rtrim(value).rbegin())!=quote)
>              {
> -              if (not in.eof())
> +              if (! in.eof())
>                {
>                  std::string l;
>                  getline(in, l);
ists.dune-project.org/mailman/listinfo/dune-commit
> 





More information about the Dune-devel mailing list