Skip to content

Commit 3ca5a61

Browse files
committed
docs: unleashed defaults goto, C-operators and macros on
1 parent 2b7024f commit 3ca5a61

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

‎unleashed/docs/tweaks.md‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,24 @@ Just the parser. When the comparison-level expression sees `is` followed by `not
102102

103103
Outside unleashed mode the parser rejects both: `obj is not T` is read as `obj is (not T)` and triggers an operator error, and `x not in S` produces a syntax error at `not`.
104104

105+
## Default-on switches
106+
107+
Three module-level switches that are off by default in `objfpc`/`fpc` are turned on automatically by `{$mode unleashed}`, so the constructs they gate work out of the box:
108+
109+
| Switch | Directive / flag | What it enables |
110+
|---------------------|----------------------------|--------------------------------------------------|
111+
| goto support | `{$goto on}` / `-Sg` | `label` declarations and `goto` |
112+
| C-style operators | `{$coperators on}` / `-Sc` | `+=`, `-=`, `*=`, `/=` (see [compound-assignment.md](compound-assignment.md)) |
113+
| macros | `{$macro on}` / `-Sm` | text-substitution macros (`$define name := value`) |
114+
115+
(`inline` is on too, but that comes from the `objfpc` base mode, not an unleashed addition.)
116+
117+
You can still turn any of them back off locally with the `off` form of the directive, e.g. `{$goto off}`.
118+
119+
### What unleashed actually changes
120+
121+
The mode handler includes `cs_support_goto`, `cs_support_c_operators` and `cs_support_macro` in the module switches whenever `m_unleashed` is set, mirroring how `delphi`/`tp7`/`mac` already default `goto` on.
122+
105123
## Future tweaks
106124

107125
This page is the catalogue for small unleashed-only semantic adjustments. As more of them land, they get appended here with the same shape: what the standard does, what unleashed changes, and how to opt back into the standard when you really need it.

0 commit comments

Comments
 (0)