View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0038132 | FPC | Documentation | public | 2020-11-25 13:27 | 2020-11-27 09:33 |
Reporter | Kai Burghardt | Assigned To | Michael Van Canneyt | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Platform | x86_64 | OS | GNU/Linux | ||
Product Version | 3.2.0 | ||||
Fixed in Version | 3.3.1 | ||||
Summary | 0038132: Reference Guide: `class var` is accepted in other modes too, but Ref suggests otherwise | ||||
Description | § 5.3 “Class or Static fields” suggests that `class var` only works in Delphi modes, yet the objFPC mode does also accept the given example program. | ||||
Steps To Reproduce | 1. remove `{$static on}` 2. use `{$mode objFPC}` | ||||
Additional Information | {$static on} is redundant since 2.6.0: https://wiki.freepascal.org/User_Changes_2.6.0#The_Static_modifier_is_now_always_enabled | ||||
Tags | No tags attached. | ||||
Fixed in Revision | 1785. | ||||
FPCOldBugId | |||||
FPCTarget | 3.2.2 | ||||
Attached Files |
|
|
ref.tex.patch (929 bytes)
--- ref.tex~ 2020-11-25 12:15:28.409713583 +0000 +++ ref.tex 2020-11-25 12:27:00.814178509 +0000 @@ -3816,7 +3816,7 @@ An object can contain class or static fields: these fields are global to the object type, and act like global variables, but are known only in the scope of the object. The difference between static and class variables is purely the mode in which they work: -The \var{static} keyword will always work, the \var{class} keyword will need \var{\{\$MODE DELPHI\}}. +The \var{static} keyword will always work, the \var{class} keyword will need \var{\{\$MODE DELPHI\}} or \var{\{\$MODE OBJFPC\}}. They can be referenced from within the objects methods, but can also be referenced from outside the object by providing the fully qualified name. @@ -3824,7 +3824,6 @@ For instance, the output of the following program: \begin{verbatim} {$mode delphi} -{$static on} type cl=object l : longint; static; prog.tex.patch (747 bytes)
--- prog.tex~ 2020-11-25 12:25:37.789164345 +0000 +++ prog.tex 2020-11-25 12:27:00.814178509 +0000 @@ -1697,16 +1697,6 @@ debugging. \end{remark} -\subsection{\var{\protect\$STATIC} : Allow use of \var{Static} keyword.} - -If you specify the \var{\{\$STATIC ON\}} directive, then \var{Static} -methods are allowed for objects. \var{Static} objects methods do not require -a \var{Self} variable. They are equivalent to \var{Class} methods for -classes. By default, \var{Static} methods are not allowed. Class methods -are always allowed. Note that also static fields can be defined. - -This directive is equivalent to the \var{-St} command line option. - \subsection{\var{\protect\$STOP} : Generate fatal error message} The following code |
|
And, surprisingly, FPC 3.2.0 does not complain about -St given on the command line, but only about the “illegal directive” {$static}. I don’t know, maybe it’s just “compatibility” (… agaaaiiiin, yeesh). fpc.1.patch (321 bytes)
--- fpc.1~ 2020-11-25 12:35:15.572217696 +0000 +++ fpc.1 2020-11-25 12:35:15.572217696 +0000 @@ -675,6 +675,7 @@ .TP .BI \-St Allow the "static" keyword in objects. +Since 2.6.0 always enabled. This flag is recognized for compatibility reasons only. .TP .BI \-Un Do not check the unit name. Normally, the unit name user.tex.patch (621 bytes)
--- user.tex~ 2020-11-25 12:35:15.572217696 +0000 +++ user.tex 2020-11-25 12:35:15.572217696 +0000 @@ -1608,6 +1608,7 @@ \item [-Ss] \olabel{Ss} The name of constructors must be \var{init}, and the name of destructors should be \var{done}. \item [-St] \olabel{St} Allow the \var{static} keyword in objects. +Since 2.6.0 always enabled. The flag is recognized for compatibility reasons only. \item[-Sv] Support vector processing (uses CPU vector extensions if available) \item [-Sx] Enable exception keywords (default in Delphi/Objfpc mode). This will mark all exception related keywords as keywords, also in \tp or |
|
For me FPC 3.2.0 prints: "Warning: You are using the obsolete switch -St" |
|
You’re right. I missed that. I think the period for fading out this option gracefully, just emitting a warning, is long past. -Mgpc, -Sp, or -gd aren’t accepted anymore either. |
|
Fixed, thanks for reporting this and the patches... |
Date Modified | Username | Field | Change |
---|---|---|---|
2020-11-25 13:27 | Kai Burghardt | New Issue | |
2020-11-25 13:27 | Kai Burghardt | Status | new => assigned |
2020-11-25 13:27 | Kai Burghardt | Assigned To | => Michael Van Canneyt |
2020-11-25 13:27 | Kai Burghardt | File Added: ref.tex.patch | |
2020-11-25 13:27 | Kai Burghardt | File Added: prog.tex.patch | |
2020-11-25 13:36 | Kai Burghardt | Note Added: 0127175 | |
2020-11-25 13:36 | Kai Burghardt | File Added: fpc.1.patch | |
2020-11-25 13:36 | Kai Burghardt | File Added: user.tex.patch | |
2020-11-25 23:19 | Sven Barth | Note Added: 0127193 | |
2020-11-27 05:14 | Kai Burghardt | Note Added: 0127203 | |
2020-11-27 09:33 | Michael Van Canneyt | Status | assigned => resolved |
2020-11-27 09:33 | Michael Van Canneyt | Resolution | open => fixed |
2020-11-27 09:33 | Michael Van Canneyt | Fixed in Version | => 3.3.1 |
2020-11-27 09:33 | Michael Van Canneyt | FPCTarget | => 3.2.2 |
2020-11-27 09:33 | Michael Van Canneyt | Note Added: 0127205 | |
2020-11-27 09:33 | Michael Van Canneyt | Steps to Reproduce Updated | View Revisions |
2020-11-27 09:33 | Michael Van Canneyt | Additional Information Updated | View Revisions |
2020-11-27 09:33 | Michael Van Canneyt | Fixed in Revision | => 1785. |