Consider the following
The current compiler will compile all three, but in Test3 the 'const' term is simply ignored.
This means that pRec uses 2 bytes of Frame in Test2, but 26 bytes of frame in Test1 and Test3.
In the next release 'const' will no longer be ignored.
Test3 will fail at
with a 'Left side cannot be assigned to'.
Also, with const, parameters longer than 2 bytes will be passed by reference, meaning that pRec in Test3 will consume 2 bytes of Frame instead of 26.
I will also be removing upper limit for serial speeds at a users request.
Code
{--------------------------------------------------------------}
{ Type Declarations }
type
TTestStr = string[25];
{--------------------------------------------------------------}
{ Const Declarations }
{--------------------------------------------------------------}
{ Var Declarations }
{$IDATA}
var
TestStr : TTestStr;
{--------------------------------------------------------------}
{ functions }
procedure Test1( pRec : TTestStr );
begin
pRec := 'Fred';
end;
procedure Test2( var pRec : TTestStr );
begin
pRec := 'Jim';
end;
procedure Test3( const pRec : TTestStr );
begin
pRec := 'Sam';
end;
{ Type Declarations }
type
TTestStr = string[25];
{--------------------------------------------------------------}
{ Const Declarations }
{--------------------------------------------------------------}
{ Var Declarations }
{$IDATA}
var
TestStr : TTestStr;
{--------------------------------------------------------------}
{ functions }
procedure Test1( pRec : TTestStr );
begin
pRec := 'Fred';
end;
procedure Test2( var pRec : TTestStr );
begin
pRec := 'Jim';
end;
procedure Test3( const pRec : TTestStr );
begin
pRec := 'Sam';
end;
The current compiler will compile all three, but in Test3 the 'const' term is simply ignored.
This means that pRec uses 2 bytes of Frame in Test2, but 26 bytes of frame in Test1 and Test3.
In the next release 'const' will no longer be ignored.
Test3 will fail at
Code
pRec := 'Sam';
with a 'Left side cannot be assigned to'.
Also, with const, parameters longer than 2 bytes will be passed by reference, meaning that pRec in Test3 will consume 2 bytes of Frame instead of 26.
I will also be removing upper limit for serial speeds at a users request.