Re: [fpc-pascal] Where is the best place to declare an array?

2010-05-07 Thread spir ☣
[OT -- not fpc-related -- just a side note] On Fri, 7 May 2010 00:34:11 +0200 Jonas Maebe jonas.ma...@elis.ugent.be wrote: in general my bias would be much more against than in favour of global variables from a speed perspective In _some_ dynamic languages using a virtual machine at least

[fpc-pascal] Where is the best place to declare an array?

2010-05-06 Thread Bihar Anwar
If I remember this correctly, I've formerly ever read somewhere (in my Delphi days) that array should be declared globally (not inside a function or procedure) so that access to the array will be faster. Is this correct? If yes, does this also true in FPC? Thanks in advance.

Re: [fpc-pascal] Where is the best place to declare an array?

2010-05-06 Thread Jonas Maebe
On 06 May 2010, at 16:43, Bihar Anwar wrote: If I remember this correctly, I've formerly ever read somewhere (in my Delphi days) that array should be declared globally (not inside a function or procedure) so that access to the array will be faster. Is this correct? No. Jonas

Re: [fpc-pascal] Where is the best place to declare an array?

2010-05-06 Thread Werner Van Belle
Jonas Maebe wrote: On 06 May 2010, at 16:43, Bihar Anwar wrote: If I remember this correctly, I've formerly ever read somewhere (in my Delphi days) that array should be declared globally (not inside a function or procedure) so that access to the array will be faster. Is this correct? No.

Re[2]: [fpc-pascal] Where is the best place to declare an array?

2010-05-06 Thread José Mejuto
Hello FPC-Pascal, Thursday, May 6, 2010, 7:12:46 PM, you wrote: If I remember this correctly, I've formerly ever read somewhere (in my Delphi days) that array should be declared globally (not inside a function or procedure) so that access to the array will be faster. Is this correct? No.

Re: [fpc-pascal] Where is the best place to declare an array?

2010-05-06 Thread Jonas Maebe
On 06 May 2010, at 18:12, Werner Van Belle wrote: Jonas Maebe wrote: On 06 May 2010, at 16:43, Bihar Anwar wrote: If I remember this correctly, I've formerly ever read somewhere (in my Delphi days) that array should be declared globally (not inside a function or procedure) so that

Re: [fpc-pascal] Where is the best place to declare an array?

2010-05-06 Thread Werner Van Belle
Jonas Maebe wrote: I don't have the faintest idea why it would be true. I'll explain below Local variables (including arrays) are allocated on the stack and are accessed without any kind of indirection (except for dynamic arrays, but the same goes for globally defined dynamic arrays). This

Re: [fpc-pascal] Where is the best place to declare an array?

2010-05-06 Thread Jonas Maebe
On 06 May 2010, at 23:28, Werner Van Belle wrote: In 'human' (haha) terms: - global variable access: write data into 'ds+constant' - local variables: write data into 'ss+bp+constant'. Since the latter involves a term more I assume it is bound to take more time. That was true in the

Re: [fpc-pascal] Where is the best place to declare an array?

2010-05-06 Thread Flávio Etrusco
On Thu, May 6, 2010 at 7:34 PM, Jonas Maebe jonas.ma...@elis.ugent.be wrote: On 06 May 2010, at 23:28, Werner Van Belle wrote: In 'human' (haha) terms: - global variable access: write data into 'ds+constant' - local variables: write data into 'ss+bp+constant'. Since the latter involves a

Re: [fpc-pascal] Where is the best place to declare an array?

2010-05-06 Thread Bihar Anwar
Thanks Jose, Werner, and Jonas for the fantastic discussion and explanation. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal