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]

[v3] libstdc++/39835


Hi,

sanity-checked x86_64-linux, committed to mainline.

Paolo.

///////////////////
2009-04-21  Paolo Carlini  <paolo.carlini@oracle.com>

	PR libstdc++/39835
	* include/bits/random.h: Avoid the badname __alpha (and, for
	consistency, __beta too).
	* include/bits/random.tcc: Likewise.
Index: include/bits/random.tcc
===================================================================
--- include/bits/random.tcc	(revision 146448)
+++ include/bits/random.tcc	(working copy)
@@ -1921,14 +1921,14 @@
 	  __aurng(__urng);
 
 	bool __reject;
-	const _RealType __alpha = __param.alpha();
-	const _RealType __beta = __param.beta();
-	if (__alpha >= 1)
+	const _RealType __alpha_val = __param.alpha();
+	const _RealType __beta_val = __param.beta();
+	if (__alpha_val >= 1)
 	  {
 	    // alpha - log(4)
-	    const result_type __b = __alpha
+	    const result_type __b = __alpha_val
 	      - result_type(1.3862943611198906188344642429163531L);
-	    const result_type __c = __alpha + __param._M_l_d;
+	    const result_type __c = __alpha_val + __param._M_l_d;
 	    const result_type __1l = 1 / __param._M_l_d;
 
 	    // 1 + log(9 / 2)
@@ -1936,11 +1936,11 @@
 
 	    do
 	      {
-		const result_type __u = __aurng() / __beta;
-		const result_type __v = __aurng() / __beta;
+		const result_type __u = __aurng() / __beta_val;
+		const result_type __v = __aurng() / __beta_val;
 
 		const result_type __y = __1l * std::log(__v / (1 - __v));
-		__x = __alpha * std::exp(__y);
+		__x = __alpha_val * std::exp(__y);
 
 		const result_type __z = __u * __v * __v;
 		const result_type __r = __b + __c * __y - __x;
@@ -1953,12 +1953,12 @@
 	  }
 	else
 	  {
-	    const result_type __c = 1 / __alpha;
+	    const result_type __c = 1 / __alpha_val;
 
 	    do
 	      {
-		const result_type __z = -std::log(__aurng() / __beta);
-		const result_type __e = -std::log(__aurng() / __beta);
+		const result_type __z = -std::log(__aurng() / __beta_val);
+		const result_type __e = -std::log(__aurng() / __beta_val);
 
 		__x = std::pow(__z, __c);
 
@@ -1967,7 +1967,7 @@
 	    while (__reject);
 	  }
 
-	return __beta * __x;
+	return __beta_val * __x;
       }
 
   template<typename _RealType, typename _CharT, typename _Traits>
@@ -2005,10 +2005,10 @@
       const typename __ios_base::fmtflags __flags = __is.flags();
       __is.flags(__ios_base::dec | __ios_base::skipws);
 
-      _RealType __alpha, __beta;
-      __is >> __alpha >> __beta;
+      _RealType __alpha_val, __beta_val;
+      __is >> __alpha_val >> __beta_val;
       __x.param(typename gamma_distribution<_RealType>::
-		param_type(__alpha, __beta));
+		param_type(__alpha_val, __beta_val));
 
       __is.flags(__flags);
       return __is;
Index: include/bits/random.h
===================================================================
--- include/bits/random.h	(revision 146448)
+++ include/bits/random.h	(working copy)
@@ -3627,9 +3627,9 @@
 	friend class gamma_distribution<_RealType>;
 
 	explicit
-	param_type(_RealType __alpha = _RealType(1),
-		   _RealType __beta = _RealType(1))
-	: _M_alpha(__alpha), _M_beta(__beta)
+	param_type(_RealType __alpha_val = _RealType(1),
+		   _RealType __beta_val = _RealType(1))
+	: _M_alpha(__alpha_val), _M_beta(__beta_val)
 	{
 	  _GLIBCXX_DEBUG_ASSERT(_M_alpha > _RealType(0));
 	  _M_initialize();
@@ -3660,9 +3660,9 @@
        * @f$ \alpha @f$ and @f$ \beta @f$.
        */
       explicit
-      gamma_distribution(_RealType __alpha = _RealType(1),
-			 _RealType __beta = _RealType(1))
-      : _M_param(__alpha, __beta)
+      gamma_distribution(_RealType __alpha_val = _RealType(1),
+			 _RealType __beta_val = _RealType(1))
+      : _M_param(__alpha_val, __beta_val)
       { }
 
       explicit

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