Travis Siegel via fpc-pascal schrieb am
Di., 4. Apr. 2023, 20:34:
> I'm not positive, because I've never used them, but I'm pretty sure
> variables configured as const, can't be changed once they're defined.
For typed constants that depends on the $WritableConsts directive.
Regards,
Sven
_
On 04/04/2023 16:14, Bart via fpc-pascal wrote:
If your local "writeable constant" is of type string, and strings are
longstrings, and the writeable const is assigned a value that is the
result of a string concatenation, then you'll have a memory leak.
That does not matter in practice (*), sinc
Didn't know that either:
"It should be stressed that typed constants are automatically initialized at
program start. This is also true for local typed constants and initialized
variables. Local typed constants are also initialized at program start. If
their value was changed during previous inv
I'm not positive, because I've never used them, but I'm pretty sure
variables configured as const, can't be changed once they're defined.
If that's your intent, then feel free to use them, but it sounds like
you're trying to make variables (not constant values) last for the whole
program, with
On Tue, Apr 4, 2023 at 6:00 PM Tomas Hajny via fpc-pascal
wrote:
> Well, managed types are not very likely in code imported from a Pascal
> compiler not knowing units...
Well, his fpc.cfg might define string to be ansistring...
--
Bart
___
fpc-pascal
On 2023-04-04 16:14, Bart via fpc-pascal wrote:
On Tue, Apr 4, 2023 at 9:43 AM Jacob Kroon via fpc-pascal
wrote:
What is the technical downside to using "const", or is it just
cosmetic ?
If your local "writeable constant" is of type string, and strings are
longstrings, and the writeable cons
On Tue, Apr 4, 2023 at 9:43 AM Jacob Kroon via fpc-pascal
wrote:
> What is the technical downside to using "const", or is it just cosmetic ?
If your local "writeable constant" is of type string, and strings are
longstrings, and the writeable const is assigned a value that is the
result of a stri
On 2023-04-04 11:14, Sven Barth wrote:
Tomas Hajny via fpc-pascal schrieb
am Di., 4. Apr. 2023, 09:51:
.
.
If you read the documentation (wiki or the real documentation in
PDF/HTML etc.) properly, you don't find there anything saying that
constants declared locally within functions or proce
Tomas Hajny via fpc-pascal schrieb am
Di., 4. Apr. 2023, 09:51:
> On 2023-04-04 09:43, Jacob Kroon wrote:
>
>
> Hi Jacob,
>
> >> You don't need to change "var" to "const" - if you want to ensure the
> >> variables to persist in between the function/procedure runs, you need
> >> to move them to th
Hi Tomas,
On 4/4/23 09:51, Tomas Hajny wrote:
On 2023-04-04 09:43, Jacob Kroon wrote:
Hi Jacob,
You don't need to change "var" to "const" - if you want to ensure the
variables to persist in between the function/procedure runs, you need
to move them to the global level, i.e. outside of the
On 2023-04-04 09:43, Jacob Kroon wrote:
Hi Jacob,
You don't need to change "var" to "const" - if you want to ensure the
variables to persist in between the function/procedure runs, you need
to move them to the global level, i.e. outside of the
functions/procedures. It is not advisable as a g
Hi Michael,
On 4/4/23 09:05, Michael Van Canneyt wrote:
[cut]
Do I have any other option besides changing from "var" to "const"
everywhere, and provide initial values in all declarations ?
Make them actually global variables.
procedure X;
Var
y : integer;
begin
// Use y
end;
becomes
Hi Tomas,
On 4/4/23 09:01, Tomas Hajny via fpc-pascal wrote:
[cut]
You don't need to change "var" to "const" - if you want to ensure the
variables to persist in between the function/procedure runs, you need to
move them to the global level, i.e. outside of the functions/procedures.
It is not
Hi Bernd,
On 4/4/23 08:54, Bernd Oppolzer via fpc-pascal wrote:
Am 04.04.2023 um 08:16 schrieb Jacob Kroon via fpc-pascal:
Thanks for the tip above.
I was able to write a couple of perl-scripts that are able to convert
my old Pascal sources to something that fpc can parse. Amongst other
thi
On Tue, 4 Apr 2023, Jacob Kroon via fpc-pascal wrote:
Hi Charlie, everyone,
On 3/28/23 11:33, Karoly Balogh wrote:
[cut]
If you want to export a variable without name mangling, you must declare a
public name for it, something like:
var
foobar: integer; public name '_myfoobar';
Then
Am 04.04.2023 um 08:16 schrieb Jacob Kroon via fpc-pascal:
Thanks for the tip above.
I was able to write a couple of perl-scripts that are able to convert
my old Pascal sources to something that fpc can parse. Amongst other
things, the scripts inject the "public name"/"external name"
annotat
On 2023-04-04 08:16, Jacob Kroon via fpc-pascal wrote:
Hi Jacob,
.
.
But I suspect I have a new problem: With the old Pascal/MT+ compiler
it would appear that local variables declared in functions/procedures
have a life-time that spans the whole program, like a "static"
declared variable in
Hi Charlie, everyone,
On 3/28/23 11:33, Karoly Balogh wrote:
[cut]
If you want to export a variable without name mangling, you must declare a
public name for it, something like:
var
foobar: integer; public name '_myfoobar';
Then reference it as:
var
foobar: integer; external name '_m
On 3/28/2023 3:12 AM, Marco van de Voort via fpc-pascal wrote:
On 28-3-2023 11:33, Karoly Balogh via fpc-pascal wrote:
Probably yes, but there might be an alternative, see below. But as
far as
I understand, Unit is a Turbo Pascal concept, so any Pascal programming
dialect that predates it, p
On 3/27/2023 2:45 AM, Jacob Kroon via fpc-pascal wrote:
Hi,
I have some old Pascal code that was compiled in a CPM environment
using the Pascal/MT+ compiler from Digital Research. I'm trying to get
this project to build in a modern environment, for a start using
FreePascal.
First, is anyone
On 28-3-2023 11:33, Karoly Balogh via fpc-pascal wrote:
Probably yes, but there might be an alternative, see below. But as far as
I understand, Unit is a Turbo Pascal concept, so any Pascal programming
dialect that predates it, probably don't understand it.
True, and before units in Turbo Pa
On 2023-03-28 11:33, Karoly Balogh via fpc-pascal wrote:
Hi,
.
.
You might wanna consider this approach, because if units somehow end up
cross-referencing each other, then you might run into difficulties
restructuring the code to use Units. Also, it is possible to
cross-reference units from
Hi,
On Mon, 27 Mar 2023, Jacob Kroon via fpc-pascal wrote:
> As I understand it, in order to translate this to something that FreePascal
> understands, the variable needs to go in a "unit" and be part of its
> interface. Then, pascal sources that needs to reference the variable should
> use this
On 2023-03-27 11:45, Jacob Kroon via fpc-pascal wrote:
Hi,
I have some old Pascal code that was compiled in a CPM environment
using the Pascal/MT+ compiler from Digital Research. I'm trying to get
this project to build in a modern environment, for a start using
FreePascal.
First, is anyone aw
24 matches
Mail list logo