Recent

Author Topic: Compiler: {$INCLUDE %DATE%} turns on IO Checking?  (Read 907 times)

AlanTheBeast

  • Sr. Member
  • ****
  • Posts: 348
  • My software never cras....
Compiler: {$INCLUDE %DATE%} turns on IO Checking?
« on: July 02, 2022, 08:54:27 pm »
Hope nobody has tried to test my earlier assertion.  Editing goofs led me down a path....

I have a section of code set to {$I-} as I check IOResult.

I added the line:
      S := {$INCLUDE %DATE%}+'::'+{$INCLUDE %TIME%};
to be able to print out the program compiled date/time.

And IOChecking is turned on again!
(Added {$I-} after the above to mitigate, but this seems like a doozy of an error in the compiler...?)


FPC: Free Pascal Compiler version 3.2.0 [2020/05/31] for x86_64
« Last Edit: July 02, 2022, 10:41:29 pm by AlanTheBeast »
Everyone talks about the weather but nobody does anything about it.
..Samuel Clemens.

MarkMLl

  • Hero Member
  • *****
  • Posts: 6676
Re: Compiler: {$INCLUDE %DATE%} turns on IO Checking?
« Reply #1 on: July 02, 2022, 10:03:14 pm »
I've not seen that but I usually put them in constants first, like

Code: Pascal  [Select][+][-]
  1. CONST   manifestDate= (*$I %DATE% *) ;
  2.         manifestTime= (*$I %TIME% *) ;
  3.  

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

AlanTheBeast

  • Sr. Member
  • ****
  • Posts: 348
  • My software never cras....
Re: Compiler: {$INCLUDE %DATE%} turns on IO Checking?
« Reply #2 on: July 02, 2022, 10:22:24 pm »
Good idea. I'll implement it that way.

But - I was wrong about my earlier assertion of it the $INCLUDE causing IO checking to be turned on
« Last Edit: July 02, 2022, 10:33:52 pm by AlanTheBeast »
Everyone talks about the weather but nobody does anything about it.
..Samuel Clemens.

MarkMLl

  • Hero Member
  • *****
  • Posts: 6676
Re: Compiler: {$INCLUDE %DATE%} turns on IO Checking?
« Reply #3 on: July 02, 2022, 10:50:24 pm »
Yes, but /why/? What had happened?

It does raise the interesting question about whether the state of any particular setting can be checked: ISTR that there is an IFOPT for some but not all, and $I is sufficiently overloaded that it could be problematic.

MarkMLl
« Last Edit: July 02, 2022, 11:06:49 pm by MarkMLl »
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

AlanTheBeast

  • Sr. Member
  • ****
  • Posts: 348
  • My software never cras....
Re: Compiler: {$INCLUDE %DATE%} turns on IO Checking?
« Reply #4 on: July 03, 2022, 12:11:53 am »
Yes, but /why/? What had happened?
I was changing some of the top of the file options and testing LOOPUNROLL for S&G (looking at the generated assembler - it is, in some instances, well worth it). 

At some point I clobbered the existing {$I-} w/o realizing it.

It does raise the interesting question about whether the state of any particular setting can be checked: ISTR that there is an IFOPT for some but not all, and $I is sufficiently overloaded that it could be problematic.

I personally wouldn't be offended if all pragmas were in long form only from some point in the compiler evolution. 
Force everyone to update their code too (or have a competition to write the best auto-fixer).

It is now officially beer time.  G'night.
Everyone talks about the weather but nobody does anything about it.
..Samuel Clemens.

PascalDragon

  • Hero Member
  • *****
  • Posts: 5446
  • Compiler Developer
Re: Compiler: {$INCLUDE %DATE%} turns on IO Checking?
« Reply #5 on: July 03, 2022, 02:25:51 pm »
It does raise the interesting question about whether the state of any particular setting can be checked: ISTR that there is an IFOPT for some but not all, and $I is sufficiently overloaded that it could be problematic.

I personally wouldn't be offended if all pragmas were in long form only from some point in the compiler evolution. 
Force everyone to update their code too (or have a competition to write the best auto-fixer).

First of they aren't called pragmas, they're compiler directives (or simply directives).
Second new directives don't receive a single letter directive except where required by compatibility with other compilers.
Third existing directives will not be changed, except to fix bugs. Thus the overloading of $I will stay.

AlanTheBeast

  • Sr. Member
  • ****
  • Posts: 348
  • My software never cras....
Re: Compiler: {$INCLUDE %DATE%} turns on IO Checking?
« Reply #6 on: July 03, 2022, 03:22:21 pm »
It does raise the interesting question about whether the state of any particular setting can be checked: ISTR that there is an IFOPT for some but not all, and $I is sufficiently overloaded that it could be problematic.

I personally wouldn't be offended if all pragmas were in long form only from some point in the compiler evolution. 
Force everyone to update their code too (or have a competition to write the best auto-fixer).

First of they aren't called pragmas, they're compiler directives (or simply directives).
Second new directives don't receive a single letter directive except where required by compatibility with other compilers.
Third existing directives will not be changed, except to fix bugs. Thus the overloading of $I will stay.

1. Pardon me.
2. Good and exceptional pity.
3. Pitier.

Everyone talks about the weather but nobody does anything about it.
..Samuel Clemens.

MarkMLl

  • Hero Member
  • *****
  • Posts: 6676
Re: Compiler: {$INCLUDE %DATE%} turns on IO Checking?
« Reply #7 on: July 03, 2022, 03:35:52 pm »
Frankly I have nothing against the use of /pragma/ in the context of ALGOL-derived languages, particularly in cases discussing multiple implementations and portability.

Provided, of course, that they are correctly pluralised as /pragmata/ :-)

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

Thaddy

  • Hero Member
  • *****
  • Posts: 14205
  • Probably until I exterminate Putin.
Re: Compiler: {$INCLUDE %DATE%} turns on IO Checking?
« Reply #8 on: July 03, 2022, 04:53:39 pm »
πράγμα and it it is just shorthand.
Specialize a type, not a var.

MarkMLl

  • Hero Member
  • *****
  • Posts: 6676
Re: Compiler: {$INCLUDE %DATE%} turns on IO Checking?
« Reply #9 on: July 03, 2022, 05:34:10 pm »
It's Greek to me :-)

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

PascalDragon

  • Hero Member
  • *****
  • Posts: 5446
  • Compiler Developer
Re: Compiler: {$INCLUDE %DATE%} turns on IO Checking?
« Reply #10 on: July 04, 2022, 01:47:18 pm »
Frankly I have nothing against the use of /pragma/ in the context of ALGOL-derived languages, particularly in cases discussing multiple implementations and portability.

We should use the same terminology as the documentation and there they are named directives.

 

TinyPortal © 2005-2018