[SOLVED] Which {$modeswitch xyz} enables 'array of const' in {$mode TP} ? lazarus / 21-General ---------------------------------------------------------------------- Hartmut · 2022-11-20 14:12 I have a unit which for compatibility reasons has {$mode TP} = Turbo Pascal Mode. Now I want to use 'array of const' in this unit, if possible. For most features there is a switch like {$modeswitch xyz} to enable such things, but I found no one for 'array of const'. Does it not exist or how is it named? Thanks in advance. ---------------------------------------------------------------------- KodeZwerg · 2022-11-20 14:35 https://wiki.lazarus.freepascal.org/Basic_Pascal_Tutorial/Chapter_1/Co nstants This is how to use such in FPC. I hope that answers your question. ---------------------------------------------------------------------- Hartmut · 2022-11-20 16:21 Thank you KodeZwerg for your reply, but it seems that we misunderstood. I'm searching for a special {$modeswitch xyz} to enable 'array of const' in {$mode TP} which is not contained in your link. ---------------------------------------------------------------------- 440bx · 2022-11-20 16:37 Quote from: Hartmut on November 20, 2022, 05:21:33 pmI'm searching for a special {$modeswitch xyz} to enable 'array of const' in {$mode TP} which is not contained in your link. I could be wrong but, I don't think the "array of const" construction is available in TP mode.  I believe "array of const" was introduced with Delphi which leaves TP out of luck. Hopefully one of the FPC developers can confirm or, shoot that down, as appropriate. ---------------------------------------------------------------------- Thaddy · 2022-11-20 17:57 You are right, mode tp or fpc does not work. You will need mode delphi or objfpc. ---------------------------------------------------------------------- Hartmut · 2022-11-20 18:03 Quote from: 440bx on November 20, 2022, 05:37:17 pmQuote from: Hartmut on November 20, 2022, 05:21:33 pmI'm searching for a special {$modeswitch xyz} to enable 'array of const' in {$mode TP} which is not contained in your link. I could be wrong but, I don't think the "array of const" construction is available in TP mode.  I believe "array of const" was introduced with Delphi which leaves TP out of luck. Thank you 440bx for your answer, but as you write, you are not sure. There are many compiler features, which can be enabled in TP Mode via a specific {$modeswitch xyz}. I hope that this is the case also for 'array of const'... QuoteHopefully one of the FPC developers can confirm or, shoot that down, as appropriate. Yes, I hope that too. ---------------------------------------------------------------------- Hartmut · 2022-11-20 18:05 Quote from: Thaddy on November 20, 2022, 06:57:20 pmYou are right, mode tp or fpc does not work. You will need mode delphi or objfpc. Thank you Thaddy. Please excuse the question: how sure are you, that no {$modeswitch xyz} exists for that? ---------------------------------------------------------------------- 440bx · 2022-11-20 18:13 Quote from: Hartmut on November 20, 2022, 07:03:27 pmThank you 440bx for your answer, but as you write, you are not sure. You're welcome and, you're right, I am not sure.  No list of modeswitch(es) I've looked at seemed related to "array of const", hence the "conclusion". ---------------------------------------------------------------------- PascalDragon · 2022-11-20 21:46 Quote from: Hartmut on November 20, 2022, 03:12:30 pmI have a unit which for compatibility reasons has {$mode TP} = Turbo Pascal Mode. Now I want to use 'array of const' in this unit, if possible. For most features there is a switch like {$modeswitch xyz} to enable such things, but I found no one for 'array of const'. Does it not exist or how is it named? Thanks in advance. The array of const feature is bound to the modeswitch ObjPas which is enabled by default in modes ObjFPC, Delphi and MacPas. Enabling that in mode TP will significantly change how the code behaves and you could just as well convert your unit to mode Delphi or ObjFPC then. ---------------------------------------------------------------------- Hartmut · 2022-11-21 09:50 Thank you very much PascalDragon for that very clear and precise answer.