This is the mail archive of the gcc-patches@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]
Other format: [Raw text]

Re: [PATCH] Assertify l*.c


Richard Guenther wrote:
On Apr 1, 2005 4:15 PM, Nathan Sidwell <nathan@codesourcery.com> wrote:

   inc = INTVAL (increment);
+   gcc_assert (inc);
   if (inc > 0)
     {
       abs_diff = INTVAL (final_value) - INTVAL (initial_value);
       abs_inc = inc;
     }
!   else
     {
       abs_diff = INTVAL (initial_value) - INTVAL (final_value);
       abs_inc = -inc;
     }

I think these sort of transformations make the code less readable.
that's reasonable.  I did think about it when I was transforming the code,
and went the way I've gone in other such cases.  Feel free to patch it back
if you want :)


> I'd suggest
at least spelling the assert like

gcc_assert (inc != 0);

Y'know, I really don't understand this POV. The C language specifies that expressions in boolean context are implicitly compared against zero. Adding in the '!= 0' part invites an infinite series of '!= 0' as Hofstadter writes in 'Goedel, Escher, Bach'.

My 2pennies :)

nathan

--
Nathan Sidwell    ::   http://www.codesourcery.com   ::     CodeSourcery LLC
nathan@codesourcery.com    ::     http://www.planetfall.pwp.blueyonder.co.uk


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