docs: expand on the `_d_customflag.v` limitations

pull/8449/head
Delyan Angelov 2021-01-30 18:03:15 +02:00
parent 9c82eec529
commit 8505d2ca82
No known key found for this signature in database
GPG Key ID: 66886C0F12D595ED
1 changed files with 9 additions and 2 deletions

View File

@ -3312,8 +3312,6 @@ If a file has an environment-specific suffix, it will only be compiled for that
- `.c.v` => will be used only by the C backend. These files can contain C. code.
- `.x64.v` => will be used only by V's x64 backend.
- `_nix.c.v` => will be used only on Unix systems (non Windows).
- `_d_customflag.v` => will be used only if you pass `-d customflag` to V.
That corresponds to `$if customflag ? {}`, but for a whole file, not just a single block.
- `_${os}.c.v` => will be used only on the specific `os` system.
For example, `_windows.c.v` will be used only when compiling on Windows, or with `-os windows`.
- `_default.c.v` => will be used only if there is NOT a more specific platform file.
@ -3352,6 +3350,15 @@ With the example above:
- when you compile for any other platform, you will get the
non specific 'Hello world' message.
- `_d_customflag.v` => will be used *only* if you pass `-d customflag` to V.
That corresponds to `$if customflag ? {}`, but for a whole file, not just a
single block. `customflag` should be a snake_case identifier, it can not
contain arbitrary characters (only lower case latin letters + numbers + `_`).
NB: a combinatorial `_d_customflag_linux.c.v` postfix will not work.
If you do need a custom flag file, that has platform dependent code, use the
postfix `_d_customflag.v`, and then use plaftorm dependent compile time
conditional blocks inside it, i.e. `$if linux {}` etc.
## Compile time pseudo variables
V also gives your code access to a set of pseudo string variables,