Skip to content

Commit 58f4e12

Browse files
authored
v: update build.txt with new -d functionality (#21699)
1 parent d7cc5c8 commit 58f4e12

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

vlib/v/help/build/build.txt

+9-6
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,11 @@ NB: the build flags are shared with the run command too:
5252

5353
-d <flag>[=<value>], -define <flag>[=<value>]
5454
Define the provided flag.
55-
If value is not provided, it is assumed to be set to `true`.
56-
`value` should be `1` or `0` to indicate `true` and `false` respectively otherwise.
55+
If `value` is not provided, it is assumed to be set to `true`.
56+
`value` can be any pure literal like `32` (i64),`34.98` (f64), `false` (bool),
57+
`v` (char) or `"V rocks"` (string). In V code you can use `value := $d('<flag>', <default value>)`
58+
to retrieve the value assigned to `<flag>`.
59+
If no flag identifier (or value) is assigned, `$d()` will return the passed `<default value>`.
5760

5861
-g
5962
Compile the executable in debug mode, allowing code to be debugged more easily.
@@ -92,7 +95,7 @@ NB: the build flags are shared with the run command too:
9295
Compile the executable in production mode, where most optimizations are enabled.
9396
Note that most V warnings turn to errors, if you pass -prod, so you will have
9497
to fix them first.
95-
98+
9699
-no-bounds-checking
97100
Programs compiled with this option, will do no runtime checking of array access operations.
98101
Note that the performance impact of the bounds checking is usually below 3%, so in most
@@ -107,7 +110,7 @@ NB: the build flags are shared with the run command too:
107110
b) how much *nanoseconds in total* it took
108111
c) an average for each function (i.e. (b) / (a) )
109112
d) the function name
110-
113+
111114
NB: you can also combine this command with `run` command.
112115
For example - `v -prof prof.txt run main.v`
113116

@@ -176,7 +179,7 @@ NB: the build flags are shared with the run command too:
176179
Tell V to be quieter, and to not show many otherwise helpful messages, that only get in your
177180
way once you have read them a few dozen times. One example is the notice message, usually
178181
shown for `v -prod run file.v`, that says that -prod should not be used with run .
179-
Note, this option *does not affect* errors/warnings/notices, just messages that V prints in
182+
Note, this option *does not affect* errors/warnings/notices, just messages that V prints in
180183
order to be more user friendly, in common situations, that are error prone for new users, and
181184
that just needlessly take vertical space, once you are well aware of them.
182185

@@ -248,4 +251,4 @@ For Native-specific build flags, use `v help build-native`.
248251
For WebAssembly-specific build flags, use `v help build-wasm`.
249252

250253
See also:
251-
`v help run` for documentation regarding `v run`.
254+
`v help run` for documentation regarding `v run`.

0 commit comments

Comments
 (0)