Difference between pages "Allocated" and "Multiple"

From Mesham
(Difference between pages)
Jump to navigationJump to search
 
m (5 revisions imported)
 
Line 1: Line 1:
 
== Syntax ==
 
== Syntax ==
  
allocated[type]
+
multiple[type]
  
 
Where ''type'' is optional
 
Where ''type'' is optional
Line 7: Line 7:
 
== Semantics ==
 
== Semantics ==
  
This type sets the memory allocation of a variable, which may not be modified once set.
+
Included in allocated will (with no arguments) set the specific variable to have memory allocated to all processes within current scope. This sets the variable to be private (i.e. no other processes can view it) to its allocated process.
  
 
== Example ==
 
== Example ==
  
  var i: Int :: allocated[];
+
  function void main() {
 +
    var i: Int :: allocated[multiple[]];
 +
};
  
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.
+
In this example the variable ''i'' is an integer, allocated to all processes.
 +
 
 +
''Since: Version 0.41b''
  
 
[[Category:Type Library]]
 
[[Category:Type Library]]
 
[[Category:Compound Types]]
 
[[Category:Compound Types]]
 
[[Category:Allocation Types]]
 
[[Category:Allocation Types]]

Latest revision as of 15:44, 15 April 2019

Syntax

multiple[type]

Where type is optional

Semantics

Included in allocated will (with no arguments) set the specific variable to have memory allocated to all processes within current scope. This sets the variable to be private (i.e. no other processes can view it) to its allocated process.

Example

function void main() {
   var i: Int :: allocated[multiple[]];
};

In this example the variable i is an integer, allocated to all processes.

Since: Version 0.41b