Is anyone planning to rewrite precompile.pike within the near future? If not, I will probably add some code to the current version tonight which will allow variable definitions anywhere within the code. The idea is to locate all definitions of variables and move them to the top.
Example:
int x=0; int y=1; for(int i=x;i<y;i++) ...;
will become
int x=0; int y=1; int i; for(i=x;i<y;i++) ...;
Avoid problems with compilers that wants all variables defined before the code in a function. When Nilsson and wrote the new C-based hash-methods for the Crypto module, I accidently put a variable definition in the middle of the code. GCC didn't complain but some other platforms did.
Instead of learning C better, I developed code that solves the problem... ;)
/ Marcus Agehall (Scanian)
Previous text:
Trying hard not to.. ;)
The biggest problem IMHO is that things may work just fine on my GCC but might fail on plenty of other platforms. I want to introduce something that prevents this from happening. If you have some better suggestions as how to solve that problem, I'm interested.
/ Marcus Agehall (Scanian)
Previous text:
Yes, for those cases that might be possible. I was not aware that such constructions were allowed. But one still needs to move variables defined in the code like:
... int x = 10; ...
should be
int x; ... x=10; ...
since it's not known where x is used after the definition.
/ Marcus Agehall (Scanian)
Previous text:
pike-devel@lists.lysator.liu.se