Hello,
I'm trying to refer to a writable constant using different names, for instance:
{$MODE OBJFPC}
program _Constants;
const
SOME_TEXT : pchar = 'some text';
const
OTHER_TEXT = SOME_TEXT; { illegal expression }
OTHER_TEXT : pchar = SOME_TEXT; { got SYSTEM.PChar expected SYSTEM.PChar }
begin
end.
Basically, I want to be able to sometimes refer to the "constant" SOME_TEXT using the name OTHER_TEXT but, everything I've tried so far makes the compiler unhappy.
On a different note, the error message on the second option doesn't really help much. "got SYSTEM.PChar expected SYSTEM.PChar", it's a bit disconcerting to have the compiler complain that it got what it expected (usually that's not an error
)
as the signature states, FPC v3.0.4 (haven't tested with later versions)