I had this message sometimes before.
it helps to precalculate some parts into extra-variables.
I think, with using only a few additional variables it will still be faster than calculating the same thing via stack.
GCC will use the stack when there aren't any free registers. PB doesn't do that because it happens so rarely that the user can just use temp variables or restructure the expression.
even if PB would be expanded to use stack "on demand", I would prefer a compiler-warning,
to decide myself if I like to use the stack or an additional variable.
I wish that some of the developers on the code I'm developing had recieved a similar error. I have to support calculations on a sinle line that are ten screens wide.
GedB wrote:Part of the PB philosophy. Keep it simple.
I wish that some of the developers on the code I'm developing had recieved a similar error. I have to support calculations on a sinle line that are ten screens wide.
I find this error a positive feature, if PB actually tells you that it's too complex to be done using the registers available, then it's probably too complex.
It enforces good coding in my oppinion.
I have never run into this error though, amusing.
EDIT:
However, if I had to do something as messy as that I would do it like this:
x=((a*b)+c)*((b+a)*(a+b))
or similar.
I'd have though these kind of calculations would have used the stack; although this would slow things down a little I guess!
It just caught me by surprise!
This is indeed a surprise..... Since 'x' is ultimately defined by variables with constant content, I'd expect an optimizing compiler to use constants substitution and directly insert the assignment 'x = <result>' in the object code. In this specific example, a truly optimizing compiler should not need to create code that calculates the result.
Obviously, there's room for improvement, which is a good thing.....
Last edited by dell_jockey on Wed Mar 07, 2007 11:43 am, edited 1 time in total.