--- linuxsampler/trunk/src/scriptvm/tree.cpp 2016/07/13 15:51:06 2942 +++ linuxsampler/trunk/src/scriptvm/tree.cpp 2016/07/15 15:29:04 2948 @@ -102,8 +102,12 @@ int Div::evalInt() { IntExpr* pLHS = dynamic_cast(&*lhs); - IntExpr* pRHS = dynamic_cast(&*rhs);; - return (pLHS && pRHS) ? pRHS->evalInt() == 0 ? 0 : pLHS->evalInt() / pRHS->evalInt() : 0; + IntExpr* pRHS = dynamic_cast(&*rhs); + if (!pLHS || !pRHS) return 0; + int l = pLHS->evalInt(); + int r = pRHS->evalInt(); + if (r == 0) return 0; + return l / r; } void Div::dump(int level) { @@ -373,6 +377,7 @@ void IntVariable::dump(int level) { printIndents(level); + printf("IntVariable\n"); //printf("IntVariable memPos=%d\n", memPos); } @@ -706,7 +711,16 @@ } String ConcatString::evalStr() { - return lhs->evalCastToStr() + rhs->evalCastToStr(); + // temporaries required here to enforce the associative left (to right) order + // ( required for GCC and Visual Studio, see: + // http://stackoverflow.com/questions/25842902/why-stdstring-concatenation-operator-works-like-right-associative-one + // Personally I am not convinced that this is "not a bug" of the + // compiler/STL implementation and the allegedly underlying "function call" + // nature causing this is IMO no profound reason that the C++ language's + // "+" operator's left associativity is ignored. -- Christian, 2016-07-14 ) + String l = lhs->evalCastToStr(); + String r = rhs->evalCastToStr(); + return l + r; } void ConcatString::dump(int level) {