Opened 11 years ago
Closed 11 years ago
#6191 closed Patches (fixed)
Fix variable shadowing warning in igamma_inverse.hpp
Reported by: | Owned by: | John Maddock | |
---|---|---|---|
Milestone: | To Be Determined | Component: | math |
Version: | Boost 1.48.0 | Severity: | Cosmetic |
Keywords: | Cc: |
Description
A local variable s
is redefined in find_inverse_gamma()
helper defined in the file math/special_functions/detail/igamma_inverse.hpp
resulting in annoyingly long warnings from Sun CC compiler (see below for the warning in its full glory). I suspect other compilers (e.g. g++ with -Wshadow
) would give this warning as well so I'd like to ask for the following trivial patch to be applied to fix it:
-
igamma_inverse.hpp
old new 279 279 { 280 280 // DiDonato and Morris Eq 35: 281 281 T v = log(p) + boost::math::lgamma(ap1, pol); 282 T s = 1;283 282 z = exp((v + w) / a); 284 283 s = boost::math::log1p(z / ap1 * (1 + z / (a + 2))); 285 284 z = exp((v + z - s) / a);
Removing the declaration and initialization shouldn't change the meaning of the existing code because the variable is not used before it's assigned below and the variable with the same name in enclosing scope is not used any more. But if you prefer you could also just rename this s
in nested scope to something else (its initialization is still unneeded though).
TIA!
P.S. The warning:
".../boost/math/special_functions/detail/igamma_inverse.hpp", line 282: Warning, wvarhidenmem: s hides the same name in an outer scope. ".../boost/math/special_functions/detail/igamma_inverse.hpp", line 406: Where, temwhileinst: While instantiating "boost::math::detail::find_inverse_gamma<double, boost::math::policies::policy<boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy>>(double, double, double, const boost::math::policies::policy<boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy>&, bool*)". ".../boost/math/special_functions/detail/igamma_inverse.hpp", line 406: Where, teminstfrom: Instantiated from boost::math::detail::gamma_p_inv_imp<double, boost::math::policies::policy<boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy>>(double, double, const boost::math::policies::policy<boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy, boost::math::policies::default_policy>&). ".../boost/math/special_functions/detail/igamma_inverse.hpp", line 517: Where, teminstend: Instantiated from non-template code.
Change History (2)
comment:1 by , 11 years ago
Type: | Bugs → Patches |
---|
comment:2 by , 11 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Fixed in Trunk revision #76094.