lmi
[Top][All Lists]
Advanced

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

Re: [lmi] MSVC warnings [TOMS 748 only]


From: Greg Chicares
Subject: Re: [lmi] MSVC warnings [TOMS 748 only]
Date: Mon, 6 Jun 2022 18:00:06 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.0

On 6/6/22 14:20, Vadim Zeitlin wrote:
> On Mon, 6 Jun 2022 03:37:50 +0000 Greg Chicares <gchicares@sbcglobal.net> 
> wrote:
[...]
> GC> This monstrosity in 'zero.hpp' is an 'f2c' translation from FORTRAN.
[...]
> GC> >    So I wonder if we could
> GC> >    perhaps avoid this by moving c2 and c3 declarations inside rroot_()
> GC> >    instead of keeping them in the global namespace?
> GC> 
> GC> But how can we be sure that's valid, even though they appear to
> GC> be used only in that function?

Thanks for taking care of that concern.

>  I've pinched my nose and looked at this code and can confirm that it is
> valid because they're only ever read by the function and never modified by
> it. So, in fact, both c2 and c3 are really just constants 2 and 3 and you
> could easily confirm it by:

[...snip proof; I proved it myself in a different way before looking
at your proof, but of course the conclusion is the same...]

> And because they never change, it doesn't matter if they're
> global or static (or exist at all).

Logically and mathematically, yes; although physically, no.

> the simplest possible
> change is IMO better/more in line with the current code style:

I've tested that patch and will commit it soon.

> +    static int c2 = 2;
> +    static int c3 = 3;

We can't even make those 'const' because they're passed around
by non-const pointers (changing their constness is non-minimal).


reply via email to

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