Lazarus
Home
Help
TinyPortal
Search
Login
Register
Lazarus
»
Forum
»
Free Pascal
»
General
(Moderators:
FPK
,
Tomas Hajny
) »
[SOLVED] Is there a $modeswitch to enable initialized variables in {$mode tp} ?
Free Pascal
Website
Downloads
Wiki
Documentation
Bugtracker
Mailing List
Lazarus
Website
Downloads (Laz+FPC)
Packages (OPM)
FAQ
Wiki
Documentation (RTL/FCL/LCL)
Bugtracker
CCR Bugs
IRC channel
GIT
Mailing List
Other languages
Foundation
Website
Useful Wiki Links
Project Roadmap
Getting the Source
Screenshots
How to use the forum
About donations (wiki)
Bookstore
Computer Math and Games in Pascal
(preview)
Lazarus Handbook
Search
Advanced search
Recent
Does anyone know why this...
by
TYDQ
[
Today
at 06:39:17 am]
TBGRABitmap.TextSize retu...
by
hedgehog
[
Today
at 06:07:46 am]
AI, NLP and CAI: Text Gen...
by
schuler
[
Today
at 04:26:36 am]
The weird Rewrite bug
by
ojz0r
[
Today
at 03:50:28 am]
Demoscene Square dot flag...
by
KodeZwerg
[
Today
at 03:47:30 am]
How does Castle Game Eng...
by
michalis
[
Today
at 02:51:40 am]
Lazarus for Windows on aa...
by
dsiders
[
Today
at 01:22:37 am]
Have anyone develop UEFI ...
by
440bx
[April 16, 2024, 09:39:52 pm]
For-in loop over constant...
by
VisualLab
[April 16, 2024, 09:15:53 pm]
BUG REPORT: Unable to gen...
by
PascalDragon
[April 16, 2024, 09:02:49 pm]
Lazarus project made on M...
by
Odacir
[April 16, 2024, 08:56:58 pm]
Is it possible to support...
by
PascalDragon
[April 16, 2024, 08:51:36 pm]
CORBA interface and Varia...
by
PascalDragon
[April 16, 2024, 08:35:43 pm]
Macros confuse error mess...
by
PascalDragon
[April 16, 2024, 08:13:25 pm]
Form scaling
by
fxeconomist
[April 16, 2024, 08:09:39 pm]
InstallAware Using Lazaru...
by
Thaddy
[April 16, 2024, 07:21:31 pm]
Post your internal error ...
by
Eugene Loza
[April 16, 2024, 07:12:35 pm]
C-evo: New Horizons 1.3.0...
by
Chronos
[April 16, 2024, 06:32:41 pm]
How can i make this windo...
by
Handoko
[April 16, 2024, 06:23:43 pm]
CocoaInt.CocoaIconUse no ...
by
dsiders
[April 16, 2024, 06:22:10 pm]
pre-processor symbol when...
by
paule32
[April 16, 2024, 05:11:35 pm]
How are cookies share Web...
by
Thaddy
[April 16, 2024, 04:59:59 pm]
Azure sql database will n...
by
wpflum
[April 16, 2024, 04:04:56 pm]
Values of a custom compon...
by
CM630
[April 16, 2024, 01:42:08 pm]
Arabic text, problem on L...
by
marius.maximus
[April 16, 2024, 12:59:47 pm]
« previous
next »
Print
Pages: [
1
]
Author
Topic: [SOLVED] Is there a $modeswitch to enable initialized variables in {$mode tp} ? (Read 1031 times)
Hartmut
Hero Member
Posts: 749
[SOLVED] Is there a $modeswitch to enable initialized variables in {$mode tp} ?
«
on:
January 17, 2020, 05:21:23 pm »
I want to use an initialized array variable in {$mode tp} like:
Code: Pascal
[Select]
[+]
[-]
{$mode tp}
var
a
:
array
of
integer
=
nil
;
This is not allowed (FPC 3.2.0). But for the most features of {$mode delphi} or {$mode objfpc} there is a {$modeswitch xyz} directive to enable it. In
https://www.freepascal.org/docs-html/prog/progsu105.html
I didn't find it. Does it not exist?
Thanks in advance.
«
Last Edit: January 17, 2020, 07:26:37 pm by Hartmut
»
Logged
Thaddy
Hero Member
Posts: 14364
Sensorship about opinions does not belong here.
Re: Is there a $modeswitch to enable initialized variables in {$mode tp} ?
«
Reply #1 on:
January 17, 2020, 05:23:34 pm »
mode tp doesn't know about dynamic arrays. Use either mode delphi or mode objfpc (syntax differs)
Logged
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.
Hartmut
Hero Member
Posts: 749
Re: Is there a $modeswitch to enable initialized variables in {$mode tp} ?
«
Reply #2 on:
January 17, 2020, 05:30:41 pm »
But this compiles (FPC 3.0.4):
Code: Pascal
[Select]
[+]
[-]
{$mode tp}
var
a
:
array
of
integer
;
i
:
integer
;
begin
SetLength
(
a
,
10
)
;
for
i
:
=
0
to
High
(
a
)
-
1
do
a
[
i
]
:
=
i
;
end
.
Logged
Jonas Maebe
Hero Member
Posts: 1059
Re: Is there a $modeswitch to enable initialized variables in {$mode tp} ?
«
Reply #3 on:
January 17, 2020, 05:45:20 pm »
No, there is no modeswitch for this functionality.
Logged
Hartmut
Hero Member
Posts: 749
Re: Is there a $modeswitch to enable initialized variables in {$mode tp} ?
«
Reply #4 on:
January 17, 2020, 07:26:03 pm »
This is sad news (but that's not your fault ;-). Thanks for your help, Jonas.
Logged
Print
Pages: [
1
]
« previous
next »
Lazarus
»
Forum
»
Free Pascal
»
General
(Moderators:
FPK
,
Tomas Hajny
) »
[SOLVED] Is there a $modeswitch to enable initialized variables in {$mode tp} ?
TinyPortal
© 2005-2018