Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2017-10

compiler option for $J directive

18 messages · 10 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Mr Bee

Hi,
Is there any FPC command line option for writable constanst directive {$J} or {$WRITEABLECONST} ?  Since I knew this directive, I always set it to {$J-} (because {$J+} is ridiculous). However, sometimes I forget to put it in to my source code. So, I'd like to put it in to a batch script that calls fpc with all the required compiler settings for all my programs. Unfortunately, I haven't found compiler option for this directive. Any help is appreciated. Thank you.
Regards,
–Mr Bee

Reply by email

Sven Barth
to Mr Bee

Am 08.10.2017 06:39 schrieb "Mr Bee via fpc-pascal" <

Show quoted text 5 lines
: Hi, Is there any FPC command line option for writable constanst

directive {$J} or {$WRITEABLECONST} ?

No, there is not.

Regards,
Sven

Reply by email

Marcos Douglas B. Santos
to Mr Bee: Is there any FPC command line option for writable constanst directive {$J} or…
Mr Bee wrote 12 lines
Hi, Is there any FPC command line option for writable constanst directive {$J} or {$WRITEABLECONST} ? Since I knew this directive, I always set it to {$J-} (because {$J+} is ridiculous). However, sometimes I forget to put it in to my source code. So, I'd like to put it in to a batch script that calls fpc with all the required compiler settings for all my programs. Unfortunately, I haven't found compiler option for this directive. Any help is appreciated. Thank you.

Most developers are using single .inc file that contains all directives for the whole project.
You only need to remember to include this file in all units of your projects.

Regards,
Marcos Douglas

Reply by email

leledumbo
to Michalis Kamburelis: 2017-10-08 9:03 GMT+02:00 Sven Barth via fpc-pascal : There is my old feature request…
There is my old feature request about it https://bugs.freepascal.org/view.php?id=30344 :) You can monitor it.

No one seems to care to implement it, so if you badly need it: sj.patch <http://free-pascal-general.1045716.n5.nabble.com/file/t111899/sj.patch> Apply in compiler directory (please checkout r37430 at least), I only svn diff there, not in the top level directory (I have modifications to certain packages).

Reply by email

Sven Barth
to leledumbo

Am 08.10.2017 22:24 schrieb "leledumbo via fpc-pascal" <

Show quoted text 9 lines
: > There is my old feature request about it > https://bugs.freepascal.org/view.php?id=30344 :) You can monitor it. No one seems to care to implement it, so if you badly need it: sj.patch <http://free-pascal-general.1045716.n5.nabble.com/file/t111899/sj.patch> Apply in compiler directory (please checkout r37430 at least), I only svn diff there, not in the top level directory (I have modifications to

certain

packages).

Applied in r37437. Thank you for the patch.

Regards,
Sven

Reply by email

Mr Bee
to Sven Barth

Thank you, both to Leledumbo and Sven. Will this patch be available in the next FPC v.3.0.4 release?

–Mr Bee

Pada Selasa, 10 Oktober 2017 04.44.44 WIB, Sven Barth via fpc-pascal menulis:

"leledumbo wrote 10 lines
> There is my old feature request about it > https://bugs.freepascal.org/view.php?id=30344 :) You can monitor it. No one seems to care to implement it, so if you badly need it:  sj.patch <http://free-pascal-general.1045716.n5.nabble.com/file/t111899/sj.patch> Apply in compiler directory (please checkout r37430 at least), I only svn diff there, not in the top level directory (I have modifications to certain packages).

Applied in r37437. Thank you for the patch.

Regards,
Sven

Reply by email

Mr Bee
to Marcos Douglas B. Santos: On Sun, Oct 8, 2017 at 1:38 AM, Mr Bee via fpc-pascal Most developers are using single…

2017-10-08 23:17 GMT+07:00 Marcos Douglas B. Santos :

Most developers are using single .inc file that contains all directives for the whole project.

Well, I don't like such approach. I prefer using my own shell script that I can configure for many purposes and conditions such as build release, build debug, build test, build deploy, etc. which each has different compiler setting with custom before/after action.

Regards, –Mr Bee

Reply by email

Unknown author
to leledumbo: No one seems to care to implement it, so if you badly need it: sj.patch…
leledumbo wrote 9 lines
> There is my old feature request about it > https://bugs.freepascal.org/view.php?id=30344 :) You can monitor it. No one seems to care to implement it, so if you badly need it: sj.patch <http://free-pascal-general.1045716.n5.nabble.com/file/t111899/sj.patch> Apply in compiler directory (please checkout r37430 at least), I only svn diff there, not in the top level directory (I have modifications to certain packages).

Now a patch has been integrated for this , perhaps it could be added to Lazarus Project Options | Compiler Options | Parsing

BTW why would anyone want
{$WRITEABLECONST ON}

writable constants is an oxymoron and goes against the whole philosophy of strict types which is central to Pascal.

:?

Reply by email

Juha Manninen
to Unknown author
Now a patch has been integrated for this , perhaps it could be added to Lazarus Project Options | Compiler Options | Parsing

Patches are welcome also for that.
The option must be either hidden for compiler versions that do not support it, or there must be a clear note / hint about it.

Juha

Reply by email

Sven Barth
BTW why would anyone want {$WRITEABLECONST ON} writable constants is an oxymoron and goes against the whole philosophy

of strict types which is central to Pascal.

They were used mainly back at TP times to have procedure local static variables (cause that is how they behave as inside procedures).

Regards,
Sven

Reply by email

Christo Crause
to Mr Bee
> They were used mainly back at TP times to have procedure local static

variables (cause that is how they behave as inside procedures).

Can we make the {$J-} as default in fpc and objfpc mode for the next

major release?

+1

Reply by email

Sven Barth
to Mr Bee: 2017-10-10 16:21 GMT+07:00 Sven Barth via fpc-pascal < Can we make the {$J-} as default…

Am 11.10.2017 07:00 schrieb "Mr Bee via fpc-pascal" <

Show quoted text 6 lines
: 2017-10-10 16:21 GMT+07:00 Sven Barth via fpc-pascal < : > > They were used mainly back at TP times to have procedure local static

variables (cause that is how they behave as inside procedures).

Can we make the {$J-} as default in fpc and objfpc mode for the next

major release?

The default of $J will change in *no* existing mode as that will break backwards compatibility. It doesn't matter whether it's a major release or not.

Regards,
Sven

Reply by email

Sven Barth
to Mr Bee: 2017-10-10 13:28 GMT+07:00 Marco van de Voort : I thought such a minor fix that don't…

Am 11.10.2017 05:12 schrieb "Mr Bee via fpc-pascal" <

Show quoted text 10 lines
: 2017-10-10 13:28 GMT+07:00 Marco van de Voort : > > > Since it is already largely uploaded, no. We are only waiting on some > targets. I thought such a minor fix that don't break any codes could be included.

It doesn't matter whether it's minor. Building has already started and we definitely won't start that again for something like this.

Regards,
Sven

Reply by email

Tomas Hajny
to Sven Barth: of strict types which is central to Pascal. They were used mainly back at TP times to…
Sven Barth wrote 9 lines
Am 10.10.2017 08:49 schrieb : > BTW why would anyone want > {$WRITEABLECONST ON} > > writable constants is an oxymoron and goes against the whole philosophy of strict types which is central to Pascal. They were used mainly back at TP times to have procedure local static variables (cause that is how they behave as inside procedures).

Just adding to what has been mentioned previously - they were the only possibility for variables initialized at compile time at that time. That's how mode FPC started as well - possilibity of specifying the initial value for a "var" was added much much later.

Tomas

Reply by email