Stack

From Mesham
Revision as of 16:45, 12 January 2013 by Polas (talk | contribs) (Created page with '== Syntax == stack[] == Semantics == Instructs the environment to bind the associated variable to stack frame memory which exists for a specific function only whilst it is ''al…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Syntax

stack[]

Semantics

Instructs the environment to bind the associated variable to stack frame memory which exists for a specific function only whilst it is alive. Once the corresponding function has returned then the memory is freed and hence this variable ceases to exist.

Note: This type, used for function parameters or return type instructs pass by value

Example

var i:Int :: allocated[stack];

In this example variable i is declared as an integer and allocated to all processes (by default) and also on the stack frame of the current function. Note how we have omitted the optional braces to the stack type as there are no arguments.