c++ - Strange bug that is solved with a cout -


this first time see bug one. have function:

double calc_value(string equation, int degree, char _for) {  string monom[100];  monomial monomial[100];  double val_sum[100];   memset(val_sum,0,sizeof(val_sum));   for(int = 0; < count_monom(equation); i++)  {   monom[i] = obt_mon_from(equation,i);   monomial[i] = str_to_monomial(equation,i,monom[i],_for);    //cout << monomial[i].value;    if(monomial[i].member == 2)   monomial[i].value *= -1;    val_sum[monomial[i].degree] += monomial[i].value;  }   return val_sum[degree]; } 

this function part of program solves equations, in case wonder. cannot post entire code because around 600 lines, pretty sure bug in here (anyways, if need more tell me).

if compile code gives me wrong solution, if uncomment cout in line 14 , compile , run program gives me correct answer.

if run in debug mode gives me correct answer too.

i have done little research , think programmers call heisenbug, cannot find it. can me, please?

by way, using code::blocks , gcc compiler.


Comments

Popular posts from this blog

node.js - Mongoose: Cast to ObjectId failed for value on newly created object after setting the value -

[C++][SFML 2.2] Strange Performance Issues - Moving Mouse Lowers CPU Usage -

ios - Possible to get UIButton sizeThatFits to work? -