bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: large integer truncation in regex module


From: Paul Eggert
Subject: Re: large integer truncation in regex module
Date: Mon, 28 May 2012 10:43:30 -0700
User-agent: Mozilla/5.0 (X11; Linux i686; rv:12.0) Gecko/20120430 Thunderbird/12.0.1

On 05/28/2012 08:38 AM, Steven M. Schweda wrote:
> I'm left wondering whether, say, "var = con1 << 31 << 1 | con0" offers
> so great an improvement in clarity

It's not simply clarity (which is a matter of style).
It's maintainability.  For example, if a typo had
been inadvertently put into the old 32-bit code
(a misspelled identifier, say, due to someone typing
a character by mistake), it would not have been caught
by someone compiling on the 64-bit platform.  But with
the new code, compiling on one platform verifies the
syntax on all platforms.  This is an inherent advantage
of "if (...)" over "#if ...", and it's an advantage we've
come to appreciate over time.

In this particular example, there's another maintainability
advantage to the new code: it has one copy of the
magic hexadecimal constants, not two.  So testing on a
64-bit platform also helps to test that these constants are
right on a 32-bit platform.  The old code didn't have this
property.

> I've used a bundled C compiler on HP-UX,
> which has been (intentionally) crippled to the extent of disabling the
> "-O" option(s).

As have I, but that's doesn't trump maintainability.
For us, maintainability is more important than minor
performance issues on obsolete or crippled systems.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]