I am learning "Programming languages principles" and there is a lot of information about stuff which make up a programming language . Unfortunately every material I came across until now has a lot of technical jargon involved and is very difficult to understand (Atleast for a beginner sincerely trying to understand the topic on his own by reading the material) .

This is what I could understand from the definitions (almost on every article on this topic I came across) .

Static array - subscript ranges are statically bound and storage allocation is static.
I understood that the space for the array is allocated in memory at compile time (before run time) .

Fixed stack-dynamic array - subscript ranges are statically bound, but the allocation is done at elaboration time during execution.
Now I didn't understand anything . What is meaning of the italicized phrases

Stack-dynamic array - the subscript ranges are dynamically bound, and the storage allocation is dynamic “during execution.” Once bound they remain fixed during the lifetime of the variable.
I dont understand what is meant by being 'bound' ?

I should be able to understand the remaining two definitions if I understand these three .

I know I am asking a lot .
Thanks :)

Here's a link I recently came across which I find useful for this topic . Anyone interested in this topic , check it out . :)

2 Answers
2

Static array: an array whose size is known, and whose storage is allocated, at compile time. In C, you might write at global (file) scope:

int static_array[7];

Fixed stack-dynamic array: you know the size of your array at compile time, but allow it to be allocated automatically on the stack (the size is fixed at compile time but the storage is allocated when you enter its scope, and released when you leave it)

Is this the same book as Concepts of Programming Languages? Because again, these aren't a useful classification of types, they only address the allocation mechanism. Once you pass any of these "different" things into a function, their classification under this scheme is irrelevant.

Robert.W.Sebesta Principles of programming languages . I thought its a nice book :/ . Thanks for explaining it so well . Ya,it would be nice if you elaborate others as well . :)
–
jsp99Mar 15 '12 at 15:45

I have few questions . Can you clear them :) ?
–
jsp99Mar 16 '12 at 12:24

1. So , the usual array I declare in C (in main() function) is a fixed stack dynamic array , right ? 2 . And is it a mistake that you did with fixed heap dynamic array ? What if the statement is declared globally . ?
–
jsp99Mar 16 '12 at 12:40

1

The fixed bit just means you know the size is fixed, so 4 and 5 would be identical if you can prove n == 7 at compile time. Declaring globally or locally makes no real difference under this terminology.
–
UselessMar 16 '12 at 13:05

The classification is wrong. They are all arrays, and of fixed size. The only thing that changes is the memory region where they are allocated, and sometimes, the fixed size doesn't need to be known until runtime. These are not type-changing properties. All of those things are the exact same thing- an array.