On Friday 09 May 2014, Felix Salfelder wrote:
> apparently, something causes kf and af to misbehave. which
> compilers did you use?

g++ 2.7.2 recently ..

I think I found the problem.

There are really two problems, the one you noticed and one that 
I found while investigating.

I recall noticing it a while back but there was so much else to 
do that I put it off.

The problem has to do with construction order for what I thought 
was constants.  Apparently g++ treats const (as in constant.h) 
as static objects that need to be constructed, and in this case 
the static instance of MODEL_BUILT_IN_MOS1 happened to get 
constructed before the constant MAXDBL, so NOT_INPUT was zero.

Problem solved by using #define instead.


//#ifdef HAS_NUMERIC_LIMITS
//double const MAXDBL    = std::numeric_limits<double>::max();
//#else
//double const MAXDBL    = DBL_MAX;
//#endif

#define MAXDBL (DBL_MAX)

Now I question all usage of "const" in constant.h .
Should they all revert to #define ?????

In this case, following lines could change to DBL_MAX to 
simplify, but according to C++ docs std::numeric_limits is the 
"preferred" way to do it.


The other issue that surfaced has to do with modelgen, 
particularly code generation when there is inheritance.  When 
the hide_base option is used, parameters in the base that are 
hidden and re-exposed are not properly initialized.  It appears 
to be ok when the value is a number or defaulted, but parameter 
expressions are not properly evaluated.  Missing code in 
precalc_first.


_______________________________________________
Gnucap-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/gnucap-devel

Reply via email to