Re: Array Integers vs Array Variables

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Roland Hall (nobody_at_nowhere)
Date: 02/08/04


Date: Sun, 8 Feb 2004 06:38:50 -0600


"Ray at <%=sLocation%> [MVP]" wrote:
: "Roland Hall" <nobody@nowhere> wrote in message
: news:OBrvzDj7DHA.2404@TK2MSFTNGP11.phx.gbl...
: > "Ray at <%=sLocation%> [MVP]" wrote:'
: > : True, you must use an actual number when dimming an array, because the
: > array
: > : is put in memory with the Dim statement before any variables are
: > evaluated,
: > : b in this case.
: >
: > But I already dimensioned b and it is in memory and I'm just creating a
: > reference to b, aren't I?
:
:
: b has been dimmed, but it doesn't have a value yet when the code is
: compiled. It doesn't get a value (b=10) until after all the compiling has
: finished. Part of the compiling process, as I believe, is making room in
: memory for the variables (dim). That, and checking for unterminated
: strings, syntax errors, etc. So, if you're the script interpreter, you'd
go
: to declare an array in memory and see that you should make room for "b"
: elements. But you do not know what b is, as you have not yet gotten to
the
: point at which you start reading lines like "b=10." I guess you could
: parallel this logic with why you cannot do <!-- #include
: file="<%varName%>" -->. That's a different thing, of course, but the
logic
: behind why you cannot do it is the same, if that helps at all.

Yes, this with your other post that Dim is compile-time and ReDim is
run-time makes sense.

-- 
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp


Relevant Pages

  • Re: Array Integers vs Array Variables
    ... True, you must use an actual number when dimming an array, because the ... is put in memory with the Dim statement before any variables are ... It doesn't get a value until after all the compiling has ...
    (microsoft.public.inetserver.asp.general)
  • Re: Fast string operations
    ... Looping: I thought looping over arrays in managed code was "slow" ... array handling and such. ... The problem with TrimHelper is that it always returns a new string instance. ... The customer perceives this as a memory leak. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: High Memory Consumption of Classes and Arrays
    ... Only the array itself has overhead. ... memory as a reference type. ... > least consume 40 bytes of memory. ...
    (microsoft.public.dotnet.framework.performance)
  • Re: Fast linked list
    ... > amounts of memory rather than huge chunks of it. ... random insertions into a vector/dynamic array are not as slow ... to cause a cache miss. ... some hard numbers on speed differences between lists and arrays. ...
    (microsoft.public.vc.mfc)
  • Re: Fast linked list
    ... > amounts of memory rather than huge chunks of it. ... random insertions into a vector/dynamic array are not as slow ... to cause a cache miss. ... some hard numbers on speed differences between lists and arrays. ...
    (microsoft.public.vc.language)