I don't know how to report a possible ambiguity in the manual, perhaps this post will do, or perhaps I'm wrong at all, I'm a beginner .
In the page titled "Fixed-length arrays" of the online manual says "Fixed-length arrays with automatic storage have their elements allocated on the program stack".
Instead, in the page "Dim" (in June-2019) says "If the values used with Dim to declare the dimensions of an array are all constants, the array will be created Static" [so it won't consume the program stack].
Isn't this ambigous?
On the other hand, in the same page "Dim", on the second box or example, shouldn't X,Y,D be of the same type (whether single or double)?
Static arrays, program stack, and possible ambiguity in the manual
Re: Static arrays, program stack, and possible ambiguity in the manual
We are often talking about static arrays as opposed to dynamic arrays, but in this precise case "static" means "fixed-size" et "dynamic" means "variable-size" (its becomes from the old QB metacommands: "'$Static" and "'$Dynamic", or "Option Static" and "Option Dynamic").
No relation to the declaration "STATIC [SHARED] variable AS ...".
(I will clarify the "Dim" documentation page)
In the second example of the DIM documentation page, the comment:
Remark:
In -lang qb, the INTEGER data-type is 16-bit (referenced as SHORT inside the compiler).
In the 'Dim I, J, X, Y, T$, D As Double' declaration, Double is applied on D only. The other variables are declared without "As", so their implicit types are used.
Note: At opposite, for 'Dim As Double d1, d2, d3', the Double type is applied on all variables.
No relation to the declaration "STATIC [SHARED] variable AS ...".
(I will clarify the "Dim" documentation page)
In the second example of the DIM documentation page, the comment:
should be placed after:'' I and J are INTEGERs
'' X and Y are SINGLEs
'' T$ is STRING
'' D is DOUBLE
in order to be better coherent (I will update the page).Dim I, J, X, Y, T$, D As Double
Remark:
In -lang qb, the INTEGER data-type is 16-bit (referenced as SHORT inside the compiler).
In the 'Dim I, J, X, Y, T$, D As Double' declaration, Double is applied on D only. The other variables are declared without "As", so their implicit types are used.
Note: At opposite, for 'Dim As Double d1, d2, d3', the Double type is applied on all variables.
Re: Static arrays, program stack, and possible ambiguity in the manual
Now I see clearly the different meanings of Static, many thanks.
And, oh my God! Now I remember why I've never used "AS DOUBLE", "AS LONG", etc, at the end of a DIM: it always misled me!
So a reminder for beginners: DIM AS DOUBLE X,Y,D applies to all of them, DIM X,Y,D AS DOUBLE just applies DOUBLE to D.
And, oh my God! Now I remember why I've never used "AS DOUBLE", "AS LONG", etc, at the end of a DIM: it always misled me!
So a reminder for beginners: DIM AS DOUBLE X,Y,D applies to all of them, DIM X,Y,D AS DOUBLE just applies DOUBLE to D.
Re: Static arrays, program stack, and possible ambiguity in the manual
Referring to the second declaration ('DIM X, Y, D AS DOUBLE'), the default types (for X and Y) are only valid in -lang deprecated or fblite or qb.grausvic wrote: So a reminder for beginners: DIM AS DOUBLE X,Y,D applies to all of them, DIM X,Y,D AS DOUBLE just applies DOUBLE to D.