implicit declarations

Previous topic - Next topic

MrPlow

Hi, quick one today...

Does the use of Implicit declarations affect performance or compiling for any of the mobile platforms??

I tend to leave it until the end (after debugging) so would like to know if Android or iPhone expects it in any way?
Comp:
Speccy-48k, Speccy-128k, Amigas, PCs

kanonet

I recommend turning explicit declarations on, it forces you to code in a more proper way, when you need to declare any variable in a proper way and it helps you to avoid bugs cause of misspelled variables.

And turning explicit declarations off may affect performance: if you do not define a variable, the compiler defines it as GLOBAL. But maybe that was not need (or even causes side effect in different program parts?) and you would like to declare it as LOCAL? LOCALs are faster than GLOBALs so proper declarations can save you speed. Only declare/use what you really need.

Regarding Speed:
LOCAL > GLOBAL/STATIC
Integer(%) > Float(#) > String($)
single dimension array > multi dimension array
Allocating new memory (declaring new variables, expanding arrays...) costs speed
If you use a variable as an index for an array (e.g. in an FOR loop), declare it as integer, cause otherwise it would get converted every call - which costs speed.

Ok, was more than you asked, but i hope it was a small help.
Lenovo Thinkpad T430u: Intel i5-3317U, 8GB DDR3, NVidia GeForce 620M, Micron RealSSD C400 @Win7 x64

MrPlow

Thanks Kanonet

Good to know what costs on speed...
I will redo some code and clean it up and see if the for loops are working better using those tips...
Thnks
Comp:
Speccy-48k, Speccy-128k, Amigas, PCs