Recent

Author Topic: Minor documentation error ?  (Read 1073 times)

440bx

  • Hero Member
  • *****
  • Posts: 2310
Minor documentation error ?
« on: February 08, 2021, 11:04:26 pm »
the documentation web page https://www.freepascal.org/docs-html/prog/progsu59.html refers to the existence of {$Z ON} and {$Z OFF} but, the compiler (v3.0.4) does not seem happy with them.

Quote
The {$Z} form takes a boolean argument, where ON is equivalent to {$Z4} and OFF is equivalent to {$Z1}.

...

{$Z OFF} 
Type 
  Days = (monday, tuesday, wednesday, thursday, friday, 
          saturday, sunday);
[/size]

Is this a feature introduced in a later version of FPC (after v3.0.4) ?
FPC v3.0.4 and Lazarus 1.8.2 on Windows 7 64bit.

lucamar

  • Hero Member
  • *****
  • Posts: 3911
Re: Minor documentation error ?
« Reply #1 on: February 09, 2021, 04:19:06 am »
It's not in 3.2.0 either:
Code: [Select]
Warning: Illegal compiler directive "$Z"even though it's cited in the Programmer's Guide

In the wiki page about enum types it wasn't cited until July, 2020 so it might be in trunk only ... or maybe it's a no longer acepted, old directive?
« Last Edit: February 09, 2021, 04:26:08 am by lucamar »
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

440bx

  • Hero Member
  • *****
  • Posts: 2310
Re: Minor documentation error ?
« Reply #2 on: February 09, 2021, 04:20:54 am »
@lucamar,

Thank you for checking.  Looks like it indeed is a documentation bug.
FPC v3.0.4 and Lazarus 1.8.2 on Windows 7 64bit.

bytebites

  • Sr. Member
  • ****
  • Posts: 394
Re: Minor documentation error ?
« Reply #3 on: February 09, 2021, 05:08:04 am »
{$Z+} or {$Z-} is valid in the trunk.

440bx

  • Hero Member
  • *****
  • Posts: 2310
Re: Minor documentation error ?
« Reply #4 on: February 09, 2021, 05:15:57 am »
{$Z+} or {$Z-} is valid in the trunk.
That's good but, is {$Z ON} and {$Z OFF} valid in trunk ?
FPC v3.0.4 and Lazarus 1.8.2 on Windows 7 64bit.

speter

  • Full Member
  • ***
  • Posts: 198
Re: Minor documentation error ?
« Reply #5 on: February 09, 2021, 06:13:15 am »
{$Z+} or {$Z-} is valid in the trunk.

Interestingly, the page 440bx refers to do not mention {$Z+} or {$Z-}; which could well be because its valid (only) in the trunk.
I climbed mighty mountains, and saw that they were actually tiny foothills. :)

Laz 2.0.10 / FPC 3.2.0 / Windows 10 (64bit)

lucamar

  • Hero Member
  • *****
  • Posts: 3911
Re: Minor documentation error ?
« Reply #6 on: February 09, 2021, 07:31:24 am »
Interestingly, the page 440bx refers to do not mention {$Z+} or {$Z-}; which could well be because its valid (only) in the trunk.

No, it's available also in 3.2.0.

Another posibility is that the doc writer really meant "Z+" and "Z-" but wrote "Z on/off" after some other directive which did allow it, say $SCOPEDENUMS or some such. It's difficult to say without testing all combinations in all (or a significant amount of) versions of the compiler.

What is quite clear, though, is that the doc is now wrong, whatever happened in the past or will happen in the future.
« Last Edit: February 09, 2021, 07:34:01 am by lucamar »
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

PascalDragon

  • Hero Member
  • *****
  • Posts: 2988
  • Compiler Developer
Re: Minor documentation error ?
« Reply #7 on: February 09, 2021, 09:07:10 am »
For single letter directives it's indeed + and - that are valid, not ON and OFF (and it's been this way since essentially forever). Please file a bug against the documentation.

440bx

  • Hero Member
  • *****
  • Posts: 2310
Re: Minor documentation error ?
« Reply #8 on: February 09, 2021, 09:19:45 am »
For single letter directives it's indeed + and - that are valid, not ON and OFF (and it's been this way since essentially forever). Please file a bug against the documentation.
Done.

Ticket : 0038455
FPC v3.0.4 and Lazarus 1.8.2 on Windows 7 64bit.

PascalDragon

  • Hero Member
  • *****
  • Posts: 2988
  • Compiler Developer
Re: Minor documentation error ?
« Reply #9 on: February 09, 2021, 01:14:32 pm »
Thank you.

 

TinyPortal © 2005-2018