Page 2 of 2

Posted: Sat Jun 12, 2004 12:58 pm
by Froggerprogger
Yes, I haven't thought deep enough about it's consequences.
Now I agree, static initialization should be possible for constants only.

But - as already summarized by blueznl - for global and protected should any assignment (procedurereturn/vars) work - at the time of calling. Or does anybody see a problem there, too ?

Posted: Sat Jun 12, 2004 1:28 pm
by tinman
Froggerprogger wrote:Yes, I haven't thought deep enough about it's consequences.
Now I agree, static initialization should be possible for constants only.
I don't see that it's a problem. Why can't the compiler be smart enough to detect whether the initialisation is constant only or dynamic and create the appropriate code?

Sure it's more work for Fred but isn't that what this forum is all about ;)

Posted: Sat Jun 12, 2004 1:43 pm
by blueznl
it could, but would more code as the check has to be done every call to the procedure, while a one time initalisation would only fill it up once, see? :-)

also, there's no need to check if the var existed or not, on top of the value
simply put, it always existed, and had a value

Posted: Sat Jun 12, 2004 2:30 pm
by Froggerprogger
I think tinman meant, when we use :
Static a.l = 5 / 2
it could be compiled to an initialization at program start with no check-routine included inside the procedure.
But when we type:
Static a.l = anyVar + test() + 23;
then it could be compiled in a different way: simply add the "check-for-first-run - routine" inside the procedure.

This would be the optimum, I think (now :D )

For the programmer there would be no difference between:
Static a.l = 123
or Static a.l = myProc()
because he simply wants to initialize this static var one time. The speedthing could be solved during compilation (as above). The programmer needn't care about.