This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: coding style, continuing education


From: dewar@gnat.com
Subject: Re: coding style, continuing education
Date: Mon, 15 Jan 2001 19:44:25 -0500 (EST)

> <<Caution -- sequence points, lazy evaluation, side effects. It's not just
> boolean algebra.
> 
> Tom
> >>
> 
> If this makes a difference, you are talking about seriously horrible code :-)

Bah! What about this one :-?

   /* :-))) */
   (
      // the basic things.
      (e += typespec_.matchExact (p.type())).error() || 
      (e += namespec_.match (p.name())).error() ||

      // either both enums are set or none.
      (enumspec_.isSet() && !p.eNum().isSet() || !enumspec_.isSet() && p.eNum().isSet()) && 
      (e += HW_Reason(classid,E_MATCH), 1) ||

      // either both ranges are set or none.
      (rangespec_.isSet() && !p.range().isSet() || !rangespec_.isSet() && p.range().isSet()) && 
      (e += HW_Reason(classid,E_MATCH), 1) ||
      
      // enum and range (if given) must match exactly.
      enumspec_.isSet() && (e += enumspec_.match (p.eNum())).error() ||
      rangespec_.isSet() && (e += rangespec_.match (p.range())).error() ||
      
      // either .. or ...
      (defaultspec_.isSet() && !p.def().isSet() || !defaultspec_.isSet() && p.def().isSet()) &&
      (e += HW_Reason(classid,E_MATCH), 1) ||

      (defaultspec_.isSet() && 
       ((((e += defaultspec_.value().equal(b, p.def().value())).error()) || !b) && 
          (e += HW_Reason(classid,E_MATCH), 1)))
      ) ;

Joerg

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]