Difference between pages "Allocated" and "Extern"

From Mesham
(Difference between pages)
Jump to navigationJump to search
(Syntax)
 
(Created page with '== Syntax == extern[location] Where ''location'' is optional == Semantics == Provided as additional allocation type information, this tells the compiler NOT to allocate memor…')
 
Line 1: Line 1:
 
== Syntax ==
 
== Syntax ==
  
allocated[type]
+
extern[location]
  
Where ''type'' is optional
+
Where ''location'' is optional
  
 
== Semantics ==
 
== Semantics ==
  
This type sets the memory allocation of a variable, which may not be modified once set.
+
Provided as additional allocation type information, this tells the compiler NOT to allocate memory for the variable as this has been already done externally. The ''location'' argument is optional and just tells the compiler where the variable is to be found (e.g. a C header file) if required.
 
 
== Example ==
 
 
 
var i: Int :: allocated[];
 
 
 
In this example the variable ''i'' is an integer. Although the ''allocated'' type is provided, no addition information is given and as such Mesham allocates it to each processor.
 
  
 
[[Category:Type Library]]
 
[[Category:Type Library]]
 
[[Category:Composite Types]]
 
[[Category:Composite Types]]
[[Category:Allocation Types]]
+
[[Category:Attribute Types]]

Revision as of 00:45, 4 January 2010

Syntax

extern[location]

Where location is optional

Semantics

Provided as additional allocation type information, this tells the compiler NOT to allocate memory for the variable as this has been already done externally. The location argument is optional and just tells the compiler where the variable is to be found (e.g. a C header file) if required.