Oberon Community Platform Forum
December 14, 2019, 06:50:50 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Syntax of CONST ?  (Read 4323 times)
mas
Newbie
*
Posts: 2


« on: February 04, 2008, 09:45:09 AM »

Is there somewhere a description of the new CONST feature ?
What are its effects with regard to copying/referenceing ?

What are the effects of CONST on "dada" in the following situation:
Code:
PROCEDURE bla([b]CONST[/b] gugus,dada: ARRAYOF CHAR);
END bla;
Logged
Tom
Administrator
Newbie
*****
Posts: 6


« Reply #1 on: February 04, 2008, 11:25:50 AM »

Hi Mas

The CONST parameter can be used in any situation where you can use a VAR parameter. CONST is basically a read only VAR parameter, therefore only a reference to the parameter is passed to the called procedure. The compiler automatically prohibits you from assigning values to a CONST parameter and from using it as a non CONST parameter in a procedure call.

I hope that helps.
Tom
« Last Edit: February 04, 2008, 11:36:03 AM by Tom » Logged
negelef
Administrator
Jr. Member
*****
Posts: 55


« Reply #2 on: February 04, 2008, 11:59:50 AM »

Hi Mas,

the effect of CONST on the array dada is that you are not allowed to change its contents inside the procedure bla.

Please find a more detailed description and reasons why CONST parameters were introduced here:
http://www.ocp.inf.ethz.ch/wiki/FAQ/Language
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!