From 36ec47cd203a1f119da74b868ceb92f6da7ea930 Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Sun, 6 Mar 2022 20:01:22 +0300 Subject: [PATCH] all: replace "NB:" with "Note:" (docs/comments) --- cmd/tools/detect_tcc.v | 2 +- cmd/tools/modules/testing/common.v | 2 +- cmd/tools/modules/vgit/vgit.v | 2 +- cmd/tools/oldv.v | 2 +- cmd/tools/repeat.v | 4 +-- cmd/tools/vbuild-tools.v | 2 +- cmd/tools/vfmt.v | 4 +-- cmd/tools/vrepl.v | 4 +-- cmd/tools/vtest-all.v | 4 +-- cmd/tools/vtest-parser.v | 2 +- cmd/tools/vtest-self.v | 4 +-- cmd/tools/vtest.v | 2 +- cmd/tools/vup.v | 2 +- cmd/tools/vvet/vvet.v | 2 +- cmd/tools/vwatch.v | 2 +- examples/news_fetcher.v | 2 +- examples/sokol/sounds/wav_player.v | 2 +- examples/tree_of_nodes.v | 2 +- examples/vweb/server_sent_events/server.v | 2 +- vlib/builtin/array.v | 4 +-- vlib/builtin/array_d_gcboehm_opt.v | 2 +- vlib/builtin/builtin.c.v | 8 ++--- vlib/builtin/builtin_nix.c.v | 2 +- vlib/builtin/builtin_notd_gcboehm.c.v | 2 +- vlib/builtin/float_test.v | 4 +-- vlib/builtin/int.v | 2 +- vlib/builtin/prealloc.c.v | 4 +-- vlib/builtin/string.v | 34 +++++++++---------- vlib/builtin/string_charptr_byteptr_helpers.v | 20 +++++------ vlib/builtin/string_match_glob_test.v | 2 +- vlib/crypto/ed25519/internal/ed25519_test.v | 2 +- vlib/crypto/hmac/hmac.v | 2 +- vlib/crypto/rand/rand.v | 2 +- vlib/flag/flag.v | 2 +- vlib/gg/enums.v | 2 +- vlib/gg/gg.c.v | 4 +-- vlib/gg/image.c.v | 2 +- vlib/net/ftp/ftp_test.v | 2 +- vlib/net/http/request.v | 2 +- vlib/net/tcp_read_line.v | 2 +- vlib/orm/orm.v | 2 +- vlib/orm/orm_test.v | 2 +- vlib/os/environment.c.v | 2 +- vlib/os/file.c.v | 6 ++-- vlib/os/os.c.v | 14 ++++---- vlib/os/os.js.v | 2 +- vlib/os/os.v | 2 +- vlib/os/os_nix.c.v | 2 +- vlib/os/os_test.v | 4 +-- vlib/os/process.c.v | 4 +-- vlib/os/process.js.v | 2 +- vlib/os/process.v | 2 +- vlib/os/process_nix.c.v | 2 +- vlib/os/signal.v | 2 +- vlib/rand/rand.c.v | 2 +- vlib/rand/rand.js.v | 2 +- vlib/stbi/link_to_libm.c.v | 2 +- vlib/strings/builder.c.v | 6 ++-- vlib/strings/strings.c.v | 2 +- vlib/strings/textscanner/textscanner.v | 2 +- .../many_writers_and_receivers_on_1_channel.v | 2 +- vlib/sync/once_with_param_test.v | 2 +- vlib/sync/pool/pool_test.v | 2 +- vlib/sync/stdatomic/atomic.c.v | 2 +- vlib/sync/stdatomic/atomic_test.v | 2 +- vlib/sync/threads/threads.c.v | 2 +- vlib/time/Y2K38_test.v | 2 +- vlib/time/stopwatch_test.v | 2 +- vlib/time/time_darwin.c.v | 2 +- vlib/time/time_nix.c.v | 2 +- vlib/time/time_windows.c.v | 2 +- vlib/toml/tests/burntsushi.toml-test_test.v | 2 +- vlib/toml/tests/iarna.toml-spec-tests_test.v | 2 +- vlib/v/ast/ast.v | 4 +-- vlib/v/ast/table.v | 2 +- vlib/v/ast/types.v | 4 +-- vlib/v/builder/builder.v | 4 +-- vlib/v/builder/cc.v | 2 +- vlib/v/builder/msvc.v | 4 +-- vlib/v/checker/fn.v | 2 +- vlib/v/checker/return.v | 2 +- .../tests/modules/deprecated_module/main.v | 2 +- vlib/v/compiler_errors_test.v | 6 ++-- vlib/v/doc/module.v | 2 +- vlib/v/embed_file/embed_file.v | 2 +- vlib/v/eval/object.v | 2 +- vlib/v/fmt/fmt.v | 2 +- vlib/v/gen/c/auto_str_methods.v | 2 +- vlib/v/gen/c/cgen.v | 14 ++++---- vlib/v/gen/c/cheaders.v | 4 +-- vlib/v/gen/c/cmain.v | 2 +- vlib/v/gen/c/fn.v | 2 +- vlib/v/gen/js/auto_str_methods.v | 2 +- vlib/v/gen/js/builtin_types.v | 2 +- vlib/v/gen/js/js.v | 4 +-- vlib/v/live/executable/reloader.v | 6 ++-- vlib/v/live/live_test.v | 4 +-- vlib/v/parser/containers.v | 2 +- vlib/v/parser/parser.v | 6 ++-- vlib/v/pref/pref.v | 8 ++--- vlib/v/scanner/scanner.v | 6 ++-- .../v/tests/anon_fn_returning_question_test.v | 2 +- .../v/tests/bench/math_big_gcd/bench_euclid.v | 2 +- ...odule_functions_with_maps_of_arrays_test.v | 2 +- vlib/v/tests/closure_generator_test.v | 6 ++-- vlib/v/tests/comptime_if_expr_test.v | 2 +- .../const_comptime_eval_before_vinit_test.v | 2 +- vlib/v/tests/generic_fn_infer_test.v | 2 +- vlib/v/tests/generics_method_ordering_test.v | 2 +- vlib/v/tests/if_smartcast_test.v | 2 +- ...array_of_interfaces_with_utility_fn_test.v | 2 +- vlib/v/tests/map_sumtype_values_test.v | 2 +- vlib/v/tests/match_test.v | 2 +- .../amodule/another_internal_module_test.v | 2 +- .../mut_receiver_returned_as_reference_test.v | 2 +- .../project_with_c_code_2/modc/wrapper.v | 2 +- .../project_with_c_code_3/mod1/wrapper.js.v | 2 +- .../project_with_c_code_3/mod1/wrapper.v | 2 +- .../a_program_under_bin_can_find_mod1_test.v | 2 +- vlib/v/tests/retry_test.v | 2 +- .../v/tests/string_interpolation_array_test.v | 2 +- .../sumtype_str_for_subtypes_with_str_test.v | 2 +- vlib/v/tests/type_idx_test.v | 2 +- .../fn_with_return_should_free_local_vars.v | 2 +- vlib/v/tests/valgrind/valgrind_test.v | 2 +- vlib/v/token/token.v | 4 +-- vlib/v/util/errors.v | 2 +- vlib/v/util/surrounder.v | 2 +- vlib/v/util/util.v | 4 +-- vlib/v/util/version/version.v | 2 +- vlib/v/vcache/vcache.v | 4 +-- 131 files changed, 209 insertions(+), 209 deletions(-) diff --git a/cmd/tools/detect_tcc.v b/cmd/tools/detect_tcc.v index 1543dc738..9f8f161d4 100644 --- a/cmd/tools/detect_tcc.v +++ b/cmd/tools/detect_tcc.v @@ -5,7 +5,7 @@ fn main() { } println(' -NB: `tcc` was not used, so unless you install it yourself, your backend +Note: `tcc` was not used, so unless you install it yourself, your backend C compiler will be `cc`, which is usually either `clang`, `gcc` or `msvc`. These C compilers, are several times slower at compiling C source code, diff --git a/cmd/tools/modules/testing/common.v b/cmd/tools/modules/testing/common.v index f80f0c992..90063733e 100644 --- a/cmd/tools/modules/testing/common.v +++ b/cmd/tools/modules/testing/common.v @@ -452,7 +452,7 @@ pub fn prepare_test_session(zargs string, folder string, oskipped []string, main mut skipped := oskipped.clone() next_file: for f in files { fnormalised := f.replace('\\', '/') - // NB: a `testdata` folder, is the preferred name of a folder, containing V code, + // Note: a `testdata` folder, is the preferred name of a folder, containing V code, // that you *do not want* the test framework to find incidentally for various reasons, // for example module import tests, or subtests, that are compiled/run by other parent tests // in specific configurations, etc. diff --git a/cmd/tools/modules/vgit/vgit.v b/cmd/tools/modules/vgit/vgit.v index 2a935dea1..e85c743d3 100644 --- a/cmd/tools/modules/vgit/vgit.v +++ b/cmd/tools/modules/vgit/vgit.v @@ -75,7 +75,7 @@ pub fn prepare_vc_source(vcdir string, cdir string, commit string) (string, stri } pub fn clone_or_pull(remote_git_url string, local_worktree_path string) { - // NB: after clone_or_pull, the current repo branch is === HEAD === master + // Note: after clone_or_pull, the current repo branch is === HEAD === master if os.is_dir(local_worktree_path) && os.is_dir(os.join_path_single(local_worktree_path, '.git')) { // Already existing ... Just pulling in this case is faster usually. scripting.run('git -C "$local_worktree_path" checkout --quiet master') diff --git a/cmd/tools/oldv.v b/cmd/tools/oldv.v index fff8d0ab1..e4e73866b 100644 --- a/cmd/tools/oldv.v +++ b/cmd/tools/oldv.v @@ -57,7 +57,7 @@ fn (mut c Context) compile_oldv_if_needed() { c.vgcontext.compile_oldv_if_needed() c.commit_v_hash = c.vgcontext.commit_v__hash if !os.exists(c.vgcontext.vexepath) && c.cmd_to_run.len > 0 { - // NB: 125 is a special code, that git bisect understands as 'skip this commit'. + // Note: 125 is a special code, that git bisect understands as 'skip this commit'. // it is used to inform git bisect that the current commit leads to a build failure. exit(125) } diff --git a/cmd/tools/repeat.v b/cmd/tools/repeat.v index 8adc565d9..b3b2ac56e 100644 --- a/cmd/tools/repeat.v +++ b/cmd/tools/repeat.v @@ -152,7 +152,7 @@ fn (mut context Context) parse_options() ? { mut fp := flag.new_flag_parser(os.args) fp.application(os.file_name(os.executable())) fp.version('0.0.1') - fp.description('Repeat command(s) and collect statistics. NB: you have to quote each command, if it contains spaces.') + fp.description('Repeat command(s) and collect statistics. Note: you have to quote each command, if it contains spaces.') fp.arguments_description('CMD1 CMD2 ...') fp.skip_executable() fp.limit_free_args_to_at_least(1) ? @@ -161,7 +161,7 @@ fn (mut context Context) parse_options() ? { context.warmup = fp.int('warmup', `w`, 2, 'Warmup runs. These are done *only at the start*, and are ignored.') context.show_help = fp.bool('help', `h`, false, 'Show this help screen.') context.use_newline = fp.bool('newline', `n`, false, 'Use \\n, do not overwrite the last line. Produces more output, but easier to diagnose.') - context.show_output = fp.bool('output', `O`, false, 'Show command stdout/stderr in the progress indicator for each command. NB: slower, for verbose commands.') + context.show_output = fp.bool('output', `O`, false, 'Show command stdout/stderr in the progress indicator for each command. Note: slower, for verbose commands.') context.verbose = fp.bool('verbose', `v`, false, 'Be more verbose.') context.fail_on_maxtime = fp.int('max_time', `m`, max_time, 'Fail with exit code 2, when first cmd takes above M milliseconds (regression).') context.fail_on_regress_percent = fp.int('fail_percent', `f`, max_fail_percent, 'Fail with exit code 3, when first cmd is X% slower than the rest (regression).') diff --git a/cmd/tools/vbuild-tools.v b/cmd/tools/vbuild-tools.v index 36583259b..b13f1a1ad 100644 --- a/cmd/tools/vbuild-tools.v +++ b/cmd/tools/vbuild-tools.v @@ -4,7 +4,7 @@ import os import testing import v.util -// NB: tools like vdoc are compiled in their own subfolder +// Note: tools like vdoc are compiled in their own subfolder // => cmd/tools/vdoc/vdoc.exe // Usually, they have several top level .v files in the subfolder, // that cannot be compiled separately, but instead, the whole folder, diff --git a/cmd/tools/vfmt.v b/cmd/tools/vfmt.v index c8c588686..c8cecaf07 100644 --- a/cmd/tools/vfmt.v +++ b/cmd/tools/vfmt.v @@ -17,7 +17,7 @@ import vhelp struct FormatOptions { is_l bool - is_c bool // NB: This refers to the '-c' fmt flag, NOT the C backend + is_c bool // Note: This refers to the '-c' fmt flag, NOT the C backend is_w bool is_diff bool is_verbose bool @@ -25,7 +25,7 @@ struct FormatOptions { is_debug bool is_noerror bool is_verify bool // exit(1) if the file is not vfmt'ed - is_worker bool // true *only* in the worker processes. NB: workers can crash. + is_worker bool // true *only* in the worker processes. Note: workers can crash. is_backup bool // make a `file.v.bak` copy *before* overwriting a `file.v` in place with `-w` } diff --git a/cmd/tools/vrepl.v b/cmd/tools/vrepl.v index 75128f52c..f6c25b12f 100644 --- a/cmd/tools/vrepl.v +++ b/cmd/tools/vrepl.v @@ -225,7 +225,7 @@ fn print_welcome_screen() { ] help_text := [ 'Welcome to the V REPL (for help with V itself, type $cmd_exit, then run $cmd_help).', - 'NB: the REPL is highly experimental. For best V experience, use a text editor, ', + 'Note: the REPL is highly experimental. For best V experience, use a text editor, ', 'save your code in a $file_main file and execute: $cmd_run', version.full_v_version(false), 'Use Ctrl-C or ${term.highlight_command('exit')} to exit, or ${term.highlight_command('help')} to see other available commands', @@ -387,7 +387,7 @@ fn run_repl(workdir string, vrepl_prefix string) { } } } - // NB: starting a line with 2 spaces escapes the println heuristic + // Note: starting a line with 2 spaces escapes the println heuristic if oline.starts_with(' ') { is_statement = true } diff --git a/cmd/tools/vtest-all.v b/cmd/tools/vtest-all.v index 39bef726f..78823c1c8 100644 --- a/cmd/tools/vtest-all.v +++ b/cmd/tools/vtest-all.v @@ -173,7 +173,7 @@ fn get_all_commands() []Command { } res << Command{ line: '$vexe $vargs -progress test-fmt' - okmsg: 'All .v files can be processed with `v fmt`. NB: the result may not always be compilable, but `v fmt` should not crash.' + okmsg: 'All .v files can be processed with `v fmt`. Note: the result may not always be compilable, but `v fmt` should not crash.' } res << Command{ line: '$vexe $vargs -progress test-self' @@ -201,7 +201,7 @@ fn get_all_commands() []Command { okmsg: '`v -usecache -cg` works.' rmfile: 'examples/hello_world' } - // NB: test that a program that depends on thirdparty libraries with its + // Note: test that a program that depends on thirdparty libraries with its // own #flags (tetris depends on gg, which uses sokol) can be compiled // with -usecache: res << Command{ diff --git a/cmd/tools/vtest-parser.v b/cmd/tools/vtest-parser.v index 355946172..e3650f653 100644 --- a/cmd/tools/vtest-parser.v +++ b/cmd/tools/vtest-parser.v @@ -103,7 +103,7 @@ fn process_cli_args() &Context { fp.description('Test the V parser, by parsing each .v file in each PATH,\n' + 'as if it was typed character by character by the user.\n' + 'A PATH can be either a folder, or a specific .v file.\n' + - 'NB: you *have to quote* the PATH, if it contains spaces/punctuation.') + 'Note: you *have to quote* the PATH, if it contains spaces/punctuation.') fp.arguments_description('PATH1 PATH2 ...') fp.skip_executable() context.is_help = fp.bool('help', `h`, false, 'Show help/usage screen.') diff --git a/cmd/tools/vtest-self.v b/cmd/tools/vtest-self.v index 1aeb7295b..594a06ce3 100644 --- a/cmd/tools/vtest-self.v +++ b/cmd/tools/vtest-self.v @@ -156,8 +156,8 @@ const ( ] ) -// NB: musl misses openssl, thus the http tests can not be done there -// NB: http_httpbin_test.v: fails with 'cgen error: json: map_string_string is not struct' +// Note: musl misses openssl, thus the http tests can not be done there +// Note: http_httpbin_test.v: fails with 'cgen error: json: map_string_string is not struct' fn main() { vexe := pref.vexe_path() vroot := os.dir(vexe) diff --git a/cmd/tools/vtest.v b/cmd/tools/vtest.v index 8245f1416..d087a1030 100644 --- a/cmd/tools/vtest.v +++ b/cmd/tools/vtest.v @@ -82,7 +82,7 @@ fn show_usage() { println(' B)') println(' v test file_test.v : run test functions in a given test file.') println(' v -stats test file_test.v : as above, but with more stats.') - println(' NB: you can also give many and mixed folder/ file_test.v arguments after `v test` .') + println(' Note: you can also give many and mixed folder/ file_test.v arguments after `v test` .') println('') } diff --git a/cmd/tools/vup.v b/cmd/tools/vup.v index 7b2157b62..ba1ad1b8c 100644 --- a/cmd/tools/vup.v +++ b/cmd/tools/vup.v @@ -67,7 +67,7 @@ fn (app App) update_from_master() { } fn (app App) recompile_v() { - // NB: app.vexe is more reliable than just v (which may be a symlink) + // Note: app.vexe is more reliable than just v (which may be a symlink) opts := if app.is_prod { '-prod' } else { '' } vself := '${os.quoted_path(app.vexe)} $opts self' app.vprintln('> recompiling v itself with `$vself` ...') diff --git a/cmd/tools/vvet/vvet.v b/cmd/tools/vvet/vvet.v index d109b1c61..42bc430d0 100644 --- a/cmd/tools/vvet/vvet.v +++ b/cmd/tools/vvet/vvet.v @@ -76,7 +76,7 @@ fn main() { eprintln(vt.e2string(err)) } if vfmt_err_count > 0 { - eprintln('NB: You can run `v fmt -w file.v` to fix these errors automatically') + eprintln('Note: You can run `v fmt -w file.v` to fix these errors automatically') } if vt.errors.len > 0 { exit(1) diff --git a/cmd/tools/vwatch.v b/cmd/tools/vwatch.v index 7a277ee9a..0870c1ec4 100644 --- a/cmd/tools/vwatch.v +++ b/cmd/tools/vwatch.v @@ -50,7 +50,7 @@ fn get_scan_timeout_seconds() int { // workers, thus it does not leak much. // // b) A worker process, doing the actual monitoring/polling. -// NB: *workers are started with the --vwatchworker option* +// Note: *workers are started with the --vwatchworker option* // // Worker processes will run for a limited number of iterations, then // they will do exit(255), and then the parent will start a new worker. diff --git a/examples/news_fetcher.v b/examples/news_fetcher.v index 06f8b7f95..51cd2f986 100644 --- a/examples/news_fetcher.v +++ b/examples/news_fetcher.v @@ -40,7 +40,7 @@ fn main() { mut fetcher_pool := pool.new_pool_processor( callback: worker_fetch ) - // NB: if you do not call set_max_jobs, the pool will try to use an optimal + // Note: if you do not call set_max_jobs, the pool will try to use an optimal // number of threads, one per each core in your system, which in most // cases is what you want anyway... You can override the automatic choice // by setting the VJOBS environment variable too. diff --git a/examples/sokol/sounds/wav_player.v b/examples/sokol/sounds/wav_player.v index 3c9419b94..75c5613f9 100644 --- a/examples/sokol/sounds/wav_player.v +++ b/examples/sokol/sounds/wav_player.v @@ -88,7 +88,7 @@ fn (mut p Player) free() { // http://www.lightlink.com/tjweber/StripWav/WAVE.html // http://www.lightlink.com/tjweber/StripWav/Canon.html // https://tools.ietf.org/html/draft-ema-vpim-wav-00 -// NB: > The chunks MAY appear in any order except that the Format chunk +// Note: > The chunks MAY appear in any order except that the Format chunk // > MUST be placed before the Sound data chunk (but not necessarily // > contiguous to the Sound data chunk). struct RIFFHeader { diff --git a/examples/tree_of_nodes.v b/examples/tree_of_nodes.v index 76d69a2f6..e9bb47d39 100644 --- a/examples/tree_of_nodes.v +++ b/examples/tree_of_nodes.v @@ -8,7 +8,7 @@ struct Node { right Tree } -// NB: a match expression, infers the type of its result +// Note: a match expression, infers the type of its result // from the type of the return value in the first branch, // => it needs an explicit int(0) cast here: fn size(tree Tree) int { diff --git a/examples/vweb/server_sent_events/server.v b/examples/vweb/server_sent_events/server.v index c1139d85c..bb00a897d 100644 --- a/examples/vweb/server_sent_events/server.v +++ b/examples/vweb/server_sent_events/server.v @@ -24,7 +24,7 @@ pub fn (mut app App) index() vweb.Result { fn (mut app App) sse() vweb.Result { mut session := sse.new_connection(app.conn) - // NB: you can setup session.write_timeout and session.headers here + // Note: you can setup session.write_timeout and session.headers here session.start() or { return app.server_error(501) } session.send_message(data: 'ok') or { return app.server_error(501) } for { diff --git a/vlib/builtin/array.v b/vlib/builtin/array.v index 655308d27..8e741567f 100644 --- a/vlib/builtin/array.v +++ b/vlib/builtin/array.v @@ -283,7 +283,7 @@ pub fn (mut a array) delete_many(i int, size int) { panic('array.delete: index out of range (i == $i$endidx, a.len == $a.len)') } } - // NB: if a is [12,34], a.len = 2, a.delete(0) + // Note: if a is [12,34], a.len = 2, a.delete(0) // should move (2-0-1) elements = 1 element (the 34) forward old_data := a.data new_size := a.len - size @@ -400,7 +400,7 @@ pub fn (mut a array) pop() voidptr { new_len := a.len - 1 last_elem := unsafe { &byte(a.data) + new_len * a.element_size } a.len = new_len - // NB: a.cap is not changed here *on purpose*, so that + // Note: a.cap is not changed here *on purpose*, so that // further << ops on that array will be more efficient. return unsafe { memdup(last_elem, a.element_size) } } diff --git a/vlib/builtin/array_d_gcboehm_opt.v b/vlib/builtin/array_d_gcboehm_opt.v index 132ddc7e3..09a879901 100644 --- a/vlib/builtin/array_d_gcboehm_opt.v +++ b/vlib/builtin/array_d_gcboehm_opt.v @@ -169,7 +169,7 @@ fn (mut a array) pop_noscan() voidptr { new_len := a.len - 1 last_elem := unsafe { &byte(a.data) + new_len * a.element_size } a.len = new_len - // NB: a.cap is not changed here *on purpose*, so that + // Note: a.cap is not changed here *on purpose*, so that // further << ops on that array will be more efficient. return unsafe { memdup_noscan(last_elem, a.element_size) } } diff --git a/vlib/builtin/builtin.c.v b/vlib/builtin/builtin.c.v index 13a054058..87e93bf88 100644 --- a/vlib/builtin/builtin.c.v +++ b/vlib/builtin/builtin.c.v @@ -23,11 +23,11 @@ fn vcommithash() string { // panic_debug private function that V uses for panics, -cg/-g is passed // recent versions of tcc print nicer backtraces automatically -// NB: the duplication here is because tcc_backtrace should be called directly +// Note: the duplication here is because tcc_backtrace should be called directly // inside the panic functions. [noreturn] fn panic_debug(line_no int, file string, mod string, fn_name string, s string) { - // NB: the order here is important for a stabler test output + // Note: the order here is important for a stabler test output // module is less likely to change than function, etc... // During edits, the line number will change most frequently, // so it is last @@ -387,7 +387,7 @@ pub fn v_realloc(b &byte, n int) &byte { // bytes. `old_data` must be a pointer to an existing memory block, previously // allocated with `malloc`, `v_calloc` or `vcalloc`, of size `old_data`. // realloc_data returns a pointer to the new location of the block. -// NB: if you know the old data size, it is preferable to call `realloc_data`, +// Note: if you know the old data size, it is preferable to call `realloc_data`, // instead of `v_realloc`, at least during development, because `realloc_data` // can make debugging easier, when you compile your program with // `-d debug_realloc`. @@ -400,7 +400,7 @@ pub fn realloc_data(old_data &byte, old_size int, new_size int) &byte { return unsafe { prealloc_realloc(old_data, old_size, new_size) } } $if debug_realloc ? { - // NB: this is slower, but helps debugging memory problems. + // Note: this is slower, but helps debugging memory problems. // The main idea is to always force reallocating: // 1) allocate a new memory block // 2) copy the old to the new diff --git a/vlib/builtin/builtin_nix.c.v b/vlib/builtin/builtin_nix.c.v index 52cc60257..00ecd1c11 100644 --- a/vlib/builtin/builtin_nix.c.v +++ b/vlib/builtin/builtin_nix.c.v @@ -117,7 +117,7 @@ fn print_backtrace_skipping_top_frames_linux(skipframes int) bool { output = '' } // See http://wiki.dwarfstd.org/index.php?title=Path_Discriminators - // NB: it is shortened here to just d. , just so that it fits, and so + // Note: it is shortened here to just d. , just so that it fits, and so // that the common error file:lineno: line format is enforced. output = output.replace(' (discriminator', ': (d.') eprintln('${output:-55s} | ${addr:14s} | $beforeaddr') diff --git a/vlib/builtin/builtin_notd_gcboehm.c.v b/vlib/builtin/builtin_notd_gcboehm.c.v index 0d0dfb425..71ee1aaa7 100644 --- a/vlib/builtin/builtin_notd_gcboehm.c.v +++ b/vlib/builtin/builtin_notd_gcboehm.c.v @@ -2,7 +2,7 @@ module builtin // Just define the C functions, so that V does not error because of the missing definitions. -// NB: they will NOT be used, since calls to them are wrapped with `$if gcboehm ? { }` +// Note: they will NOT be used, since calls to them are wrapped with `$if gcboehm ? { }` fn C.GC_MALLOC(n usize) voidptr diff --git a/vlib/builtin/float_test.v b/vlib/builtin/float_test.v index 77cfacebd..1a68bb638 100644 --- a/vlib/builtin/float_test.v +++ b/vlib/builtin/float_test.v @@ -174,9 +174,9 @@ fn test_float_point_formatting_rounding() { assert '${239.5:0.0f}' == '240' assert '${239.55:0.1f}' == '239.6' assert '${239.555:0.2f}' == '239.56' - assert '${239.5555:0.3f}' == '239.555' // NB: 5 ? + assert '${239.5555:0.3f}' == '239.555' // Note: 5 ? assert '${239.55555:0.4f}' == '239.5556' - assert '${239.555555:0.5f}' == '239.55555' // NB: 5 ? + assert '${239.555555:0.5f}' == '239.55555' // Note: 5 ? assert '${239.5555555:0.6f}' == '239.555556' // after this, it is all ending in 6 assert '${239.55555555:0.7f}' == '239.5555556' assert '${239.555555555:0.8f}' == '239.55555556' diff --git a/vlib/builtin/int.v b/vlib/builtin/int.v index 8782b68ec..8549145d6 100644 --- a/vlib/builtin/int.v +++ b/vlib/builtin/int.v @@ -533,7 +533,7 @@ pub fn (b []byte) clone() []byte { } // bytestr produces a string from *all* the bytes in the array. -// NB: the returned string will have .len equal to the array.len, +// Note: the returned string will have .len equal to the array.len, // even when some of the array bytes were `0`. // If you want to get a V string, that contains only the bytes till // the first `0` byte, use `tos_clone(&byte(array.data))` instead. diff --git a/vlib/builtin/prealloc.c.v b/vlib/builtin/prealloc.c.v index 616949fdd..c73baff0a 100644 --- a/vlib/builtin/prealloc.c.v +++ b/vlib/builtin/prealloc.c.v @@ -11,7 +11,7 @@ module builtin // The goal of all this is to amortize the cost of calling libc's malloc, // trading higher memory usage for a compiler (or any single threaded batch // mode program), for a ~8-10% speed increase. -// NB: `-prealloc` is NOT safe to be used for multithreaded programs! +// Note: `-prealloc` is NOT safe to be used for multithreaded programs! // size of the preallocated chunk const prealloc_block_size = 16 * 1024 * 1024 @@ -74,7 +74,7 @@ fn prealloc_vinit() { [unsafe] fn prealloc_vcleanup() { $if prealloc_stats ? { - // NB: we do 2 loops here, because string interpolation + // Note: we do 2 loops here, because string interpolation // in the first loop may still use g_memory_block // The second loop however should *not* allocate at all. mut nr_mallocs := i64(0) diff --git a/vlib/builtin/string.v b/vlib/builtin/string.v index 15083c33b..293b48bcc 100644 --- a/vlib/builtin/string.v +++ b/vlib/builtin/string.v @@ -6,7 +6,7 @@ module builtin import strconv /* -NB: A V string should be/is immutable from the point of view of +Note: A V string should be/is immutable from the point of view of V user programs after it is first created. A V string is also slightly larger than the equivalent C string because the V string also has an integer length attached. @@ -96,7 +96,7 @@ pub fn tos_clone(s &byte) string { } // tos creates a V string, given a C style pointer to a 0 terminated block. -// NB: the memory block pointed by s is *reused, not copied*! +// Note: the memory block pointed by s is *reused, not copied*! // It will panic, when the pointer `s` is 0. // See also `tos_clone`. [unsafe] @@ -111,7 +111,7 @@ pub fn tos(s &byte, len int) string { } // tos2 creates a V string, given a C style pointer to a 0 terminated block. -// NB: the memory block pointed by s is *reused, not copied*! +// Note: the memory block pointed by s is *reused, not copied*! // It will calculate the length first, thus it is more costly than `tos`. // It will panic, when the pointer `s` is 0. // It is the same as `tos3`, but for &byte pointers, avoiding callsite casts. @@ -128,7 +128,7 @@ pub fn tos2(s &byte) string { } // tos3 creates a V string, given a C style pointer to a 0 terminated block. -// NB: the memory block pointed by s is *reused, not copied*! +// Note: the memory block pointed by s is *reused, not copied*! // It will calculate the length first, so it is more costly than tos. // It will panic, when the pointer `s` is 0. // It is the same as `tos2`, but for &char pointers, avoiding callsite casts. @@ -145,7 +145,7 @@ pub fn tos3(s &char) string { } // tos4 creates a V string, given a C style pointer to a 0 terminated block. -// NB: the memory block pointed by s is *reused, not copied*! +// Note: the memory block pointed by s is *reused, not copied*! // It will calculate the length first, so it is more costly than tos. // It returns '', when given a 0 pointer `s`, it does NOT panic. // It is the same as `tos5`, but for &byte pointers, avoiding callsite casts. @@ -162,7 +162,7 @@ pub fn tos4(s &byte) string { } // tos5 creates a V string, given a C style pointer to a 0 terminated block. -// NB: the memory block pointed by s is *reused, not copied*! +// Note: the memory block pointed by s is *reused, not copied*! // It will calculate the length first, so it is more costly than tos. // It returns '', when given a 0 pointer `s`, it does NOT panic. // It is the same as `tos4`, but for &char pointers, avoiding callsite casts. @@ -179,8 +179,8 @@ pub fn tos5(s &char) string { } // vstring converts a C style string to a V string. -// NB: the memory block pointed by `bp` is *reused, not copied*! -// NB: instead of `&byte(arr.data).vstring()`, do use `tos_clone(&byte(arr.data))`. +// Note: the memory block pointed by `bp` is *reused, not copied*! +// Note: instead of `&byte(arr.data).vstring()`, do use `tos_clone(&byte(arr.data))`. // Strings returned from this function will be normal V strings beside that, // (i.e. they would be freed by V's -autofree mechanism, when they are no longer used). // See also `tos_clone`. @@ -193,7 +193,7 @@ pub fn (bp &byte) vstring() string { } // vstring_with_len converts a C style 0 terminated string to a V string. -// NB: the memory block pointed by `bp` is *reused, not copied*! +// Note: the memory block pointed by `bp` is *reused, not copied*! // This method has lower overhead compared to .vstring(), since it // does not need to calculate the length of the 0 terminated string. // See also `tos_clone`. @@ -207,11 +207,11 @@ pub fn (bp &byte) vstring_with_len(len int) string { } // vstring converts a C style string to a V string. -// NB: the memory block pointed by `bp` is *reused, not copied*! +// Note: the memory block pointed by `bp` is *reused, not copied*! // Strings returned from this function will be normal V strings beside that, // (i.e. they would be freed by V's -autofree mechanism, when they are // no longer used). -// NB: instead of `&byte(a.data).vstring()`, use `tos_clone(&byte(a.data))`. +// Note: instead of `&byte(a.data).vstring()`, use `tos_clone(&byte(a.data))`. // See also `tos_clone`. [unsafe] pub fn (cp &char) vstring() string { @@ -223,7 +223,7 @@ pub fn (cp &char) vstring() string { } // vstring_with_len converts a C style 0 terminated string to a V string. -// NB: the memory block pointed by `bp` is *reused, not copied*! +// Note: the memory block pointed by `bp` is *reused, not copied*! // This method has lower overhead compared to .vstring(), since it // does not calculate the length of the 0 terminated string. // See also `tos_clone`. @@ -237,7 +237,7 @@ pub fn (cp &char) vstring_with_len(len int) string { } // vstring_literal converts a C style string to a V string. -// NB: the memory block pointed by `bp` is *reused, not copied*! +// Note: the memory block pointed by `bp` is *reused, not copied*! // NB2: unlike vstring, vstring_literal will mark the string // as a literal, so it will not be freed by -autofree. // This is suitable for readonly strings, C string literals etc, @@ -254,7 +254,7 @@ pub fn (bp &byte) vstring_literal() string { } // vstring_with_len converts a C style string to a V string. -// NB: the memory block pointed by `bp` is *reused, not copied*! +// Note: the memory block pointed by `bp` is *reused, not copied*! // This method has lower overhead compared to .vstring_literal(), since it // does not need to calculate the length of the 0 terminated string. // See also `tos_clone`. @@ -268,7 +268,7 @@ pub fn (bp &byte) vstring_literal_with_len(len int) string { } // vstring_literal converts a C style string char* pointer to a V string. -// NB: the memory block pointed by `bp` is *reused, not copied*! +// Note: the memory block pointed by `bp` is *reused, not copied*! // See also `byteptr.vstring_literal` for more details. // See also `tos_clone`. [unsafe] @@ -282,7 +282,7 @@ pub fn (cp &char) vstring_literal() string { // vstring_literal_with_len converts a C style string char* pointer, // to a V string. -// NB: the memory block pointed by `bp` is *reused, not copied*! +// Note: the memory block pointed by `bp` is *reused, not copied*! // This method has lower overhead compared to .vstring_literal(), since it // does not need to calculate the length of the 0 terminated string. // See also `tos_clone`. @@ -1881,7 +1881,7 @@ pub fn (s string) strip_margin_custom(del byte) string { } // match_glob matches the string, with a Unix shell-style wildcard pattern. -// NB: wildcard patterns are NOT the same as regular expressions. +// Note: wildcard patterns are NOT the same as regular expressions. // They are much simpler, and do not allow backtracking, captures, etc. // The special characters used in shell-style wildcards are: // `*` - matches everything diff --git a/vlib/builtin/string_charptr_byteptr_helpers.v b/vlib/builtin/string_charptr_byteptr_helpers.v index 5b81b392c..8d39129c2 100644 --- a/vlib/builtin/string_charptr_byteptr_helpers.v +++ b/vlib/builtin/string_charptr_byteptr_helpers.v @@ -1,14 +1,14 @@ module builtin -// NB: this file will be removed soon +// Note: this file will be removed soon -// byteptr.vbytes() - makes a V []byte structure from a C style memory buffer. NB: the data is reused, NOT copied! +// byteptr.vbytes() - makes a V []byte structure from a C style memory buffer. Note: the data is reused, NOT copied! [unsafe] pub fn (data byteptr) vbytes(len int) []byte { return unsafe { voidptr(data).vbytes(len) } } -// vstring converts a C style string to a V string. NB: the string data is reused, NOT copied. +// vstring converts a C style string to a V string. Note: the string data is reused, NOT copied. // strings returned from this function will be normal V strings beside that (i.e. they would be // freed by V's -autofree mechanism, when they are no longer used). [unsafe] @@ -20,7 +20,7 @@ pub fn (bp byteptr) vstring() string { } // vstring_with_len converts a C style string to a V string. -// NB: the string data is reused, NOT copied. +// Note: the string data is reused, NOT copied. [unsafe] pub fn (bp byteptr) vstring_with_len(len int) string { return string{ @@ -31,7 +31,7 @@ pub fn (bp byteptr) vstring_with_len(len int) string { } // vstring converts C char* to V string. -// NB: the string data is reused, NOT copied. +// Note: the string data is reused, NOT copied. [unsafe] pub fn (cp charptr) vstring() string { return string{ @@ -42,7 +42,7 @@ pub fn (cp charptr) vstring() string { } // vstring_with_len converts C char* to V string. -// NB: the string data is reused, NOT copied. +// Note: the string data is reused, NOT copied. [unsafe] pub fn (cp charptr) vstring_with_len(len int) string { return string{ @@ -53,7 +53,7 @@ pub fn (cp charptr) vstring_with_len(len int) string { } // vstring_literal converts a C style string to a V string. -// NB: the string data is reused, NOT copied. +// Note: the string data is reused, NOT copied. // NB2: unlike vstring, vstring_literal will mark the string // as a literal, so it will not be freed by autofree. // This is suitable for readonly strings, C string literals etc, @@ -69,7 +69,7 @@ pub fn (bp byteptr) vstring_literal() string { } // vstring_with_len converts a C style string to a V string. -// NB: the string data is reused, NOT copied. +// Note: the string data is reused, NOT copied. [unsafe] pub fn (bp byteptr) vstring_literal_with_len(len int) string { return string{ @@ -81,7 +81,7 @@ pub fn (bp byteptr) vstring_literal_with_len(len int) string { // vstring_literal converts C char* to V string. // See also vstring_literal defined on byteptr for more details. -// NB: the string data is reused, NOT copied. +// Note: the string data is reused, NOT copied. [unsafe] pub fn (cp charptr) vstring_literal() string { return string{ @@ -93,7 +93,7 @@ pub fn (cp charptr) vstring_literal() string { // vstring_literal_with_len converts C char* to V string. // See also vstring_literal_with_len defined on byteptr. -// NB: the string data is reused, NOT copied. +// Note: the string data is reused, NOT copied. [unsafe] pub fn (cp charptr) vstring_literal_with_len(len int) string { return string{ diff --git a/vlib/builtin/string_match_glob_test.v b/vlib/builtin/string_match_glob_test.v index b08424f10..3a21ed8bf 100644 --- a/vlib/builtin/string_match_glob_test.v +++ b/vlib/builtin/string_match_glob_test.v @@ -89,7 +89,7 @@ fn test_match_glob_with_complex_patterns() { } fn test_match_glob_search_is_linear() { - // NB: these are pathological cases, when matches are performed + // Note: these are pathological cases, when matches are performed // using the exponential recursive approach, that can take many // seconds, even minutes, but take usually only microseconds, // using the linear approach from https://research.swtch.com/glob diff --git a/vlib/crypto/ed25519/internal/ed25519_test.v b/vlib/crypto/ed25519/internal/ed25519_test.v index e84fb16d5..98e3d38c7 100644 --- a/vlib/crypto/ed25519/internal/ed25519_test.v +++ b/vlib/crypto/ed25519/internal/ed25519_test.v @@ -1,6 +1,6 @@ module main -// NB: this should be in vlib/crypto/ed25519/ed25519_test.v +// Note: this should be in vlib/crypto/ed25519/ed25519_test.v // but is currently one folder below, because of a V parser/symbol registration bug. // TODO: move this test back to vlib/crypto/ed25519/ed25519_test.v import os diff --git a/vlib/crypto/hmac/hmac.v b/vlib/crypto/hmac/hmac.v index 3f45467fe..faca186b6 100644 --- a/vlib/crypto/hmac/hmac.v +++ b/vlib/crypto/hmac/hmac.v @@ -37,7 +37,7 @@ pub fn new(key []byte, data []byte, hash_func fn ([]byte) []byte, blocksize int) } // equal compares 2 MACs for equality, without leaking timing info. -// NB: if the lengths of the 2 MACs are different, probably a completely different +// Note: if the lengths of the 2 MACs are different, probably a completely different // hash function was used to generate them => no useful timing information. pub fn equal(mac1 []byte, mac2 []byte) bool { return subtle.constant_time_compare(mac1, mac2) == 1 diff --git a/vlib/crypto/rand/rand.v b/vlib/crypto/rand/rand.v index 94d40f35b..7925895d0 100644 --- a/vlib/crypto/rand/rand.v +++ b/vlib/crypto/rand/rand.v @@ -13,7 +13,7 @@ pub fn (err ReadError) msg() string { } // bytes returns an array of `bytes_needed` random bytes. -// NB: this call can block your program for a long period of time, +// Note: this call can block your program for a long period of time, // if your system does not have access to enough entropy. // See also rand.bytes(), if you do not need really random bytes, // but instead pseudo random ones, from a pseudo random generator diff --git a/vlib/flag/flag.v b/vlib/flag/flag.v index d1427ce6e..9ef26b5a6 100644 --- a/vlib/flag/flag.v +++ b/vlib/flag/flag.v @@ -100,7 +100,7 @@ pub mut: // free frees the resources allocated for the given FlagParser instance. // It should be called manually in functions that use it, and that are // marked with `[manualfree]`, otherwise, it is called automatically -// in programs, compiled with `-autofree`. NB: you should NOT use the +// in programs, compiled with `-autofree`. Note: you should NOT use the // instance over which you have called .free() for anything after the call. [unsafe] fn (mut f FlagParser) free() { diff --git a/vlib/gg/enums.v b/vlib/gg/enums.v index 54e6e6b64..f66ec852a 100644 --- a/vlib/gg/enums.v +++ b/vlib/gg/enums.v @@ -9,7 +9,7 @@ pub enum MouseButton { invalid = 256 } -// NB: unlike the MouseButton enum from above, +// Note: unlike the MouseButton enum from above, // the [flag]-ed enum here can have combined states, // representing several pressed buttons at once. diff --git a/vlib/gg/gg.c.v b/vlib/gg/gg.c.v index a471cd662..f51d9f071 100644 --- a/vlib/gg/gg.c.v +++ b/vlib/gg/gg.c.v @@ -500,7 +500,7 @@ fn (mut ctx Context) set_scale() { } } } - // NB: on older X11, `Xft.dpi` from ~/.Xresources, that sokol uses, + // Note: on older X11, `Xft.dpi` from ~/.Xresources, that sokol uses, // may not be set which leads to sapp.dpi_scale reporting incorrectly 0.0 if s < 0.1 { s = 1.0 @@ -522,7 +522,7 @@ pub fn dpi_scale() f32 { $if android { s *= android_dpi_scale() } - // NB: on older X11, `Xft.dpi` from ~/.Xresources, that sokol uses, + // Note: on older X11, `Xft.dpi` from ~/.Xresources, that sokol uses, // may not be set which leads to sapp.dpi_scale reporting incorrectly 0.0 if s < 0.1 { s = 1.0 diff --git a/vlib/gg/image.c.v b/vlib/gg/image.c.v index 26f241ba5..e1492e2f6 100644 --- a/vlib/gg/image.c.v +++ b/vlib/gg/image.c.v @@ -112,7 +112,7 @@ pub fn (ctx &Context) draw_image(x f32, y f32, width f32, height f32, img_ &Imag // new_streaming_image returns a cached `image_idx` of a special image, that // can be updated *each frame* by calling: gg.update_pixel_data(image_idx, buf) // ... where buf is a pointer to the actual pixel data for the image. -// NB: you still need to call app.gg.draw_image after that, to actually draw it. +// Note: you still need to call app.gg.draw_image after that, to actually draw it. pub fn (mut ctx Context) new_streaming_image(w int, h int, channels int, sicfg StreamingImageConfig) int { mut img := Image{} img.width = w diff --git a/vlib/net/ftp/ftp_test.v b/vlib/net/ftp/ftp_test.v index a62316d00..1c16a197a 100644 --- a/vlib/net/ftp/ftp_test.v +++ b/vlib/net/ftp/ftp_test.v @@ -4,7 +4,7 @@ fn test_ftp_cleint() { $if !network ? { return } - // NB: this function makes network calls to external servers, + // Note: this function makes network calls to external servers, // that is why it is not a very good idea to run it in CI. // If you want to run it manually, use: // `v -d network vlib/net/ftp/ftp_test.v` diff --git a/vlib/net/http/request.v b/vlib/net/http/request.v index 0373beb42..12050462c 100644 --- a/vlib/net/http/request.v +++ b/vlib/net/http/request.v @@ -280,7 +280,7 @@ pub fn (err MultiplePathAttributesError) msg() string { // multipart_form_body converts form and file data into a multipart/form // HTTP request body. It is the inverse of parse_multipart_form. Returns // (body, boundary). -// NB: Form keys should not contain quotes +// Note: Form keys should not contain quotes fn multipart_form_body(form map[string]string, files map[string][]FileData) (string, string) { alpha_numeric := 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789' boundary := rand.string_from_set(alpha_numeric, 64) diff --git a/vlib/net/tcp_read_line.v b/vlib/net/tcp_read_line.v index 57ccc9e34..3a9dd52ae 100644 --- a/vlib/net/tcp_read_line.v +++ b/vlib/net/tcp_read_line.v @@ -43,7 +43,7 @@ pub fn (mut con TcpConn) set_blocking(state bool) ? { // read_line is a *simple*, *non customizable*, blocking line reader. // It will return a line, ending with LF, or just '', on EOF. -// NB: if you want more control over the buffer, please use a buffered IO +// Note: if you want more control over the buffer, please use a buffered IO // reader instead: `io.new_buffered_reader({reader: io.make_reader(con)})` pub fn (mut con TcpConn) read_line() string { return con.read_line_max(net.max_read_line_len) diff --git a/vlib/orm/orm.v b/vlib/orm/orm.v index cdde60ba7..d65fe1cfc 100644 --- a/vlib/orm/orm.v +++ b/vlib/orm/orm.v @@ -272,7 +272,7 @@ pub fn orm_select_gen(orm SelectConfig, para string, num bool, qm string, start_ } } - // NB: do not order, if the user did not want it explicitly, + // Note: do not order, if the user did not want it explicitly, // ordering is *slow*, especially if there are no indexes! if orm.has_order { str += ' ORDER BY ' diff --git a/vlib/orm/orm_test.v b/vlib/orm/orm_test.v index e862a478b..5022e6d52 100644 --- a/vlib/orm/orm_test.v +++ b/vlib/orm/orm_test.v @@ -339,7 +339,7 @@ fn test_orm_sqlite() { updated_time_mod := sql db { select from Module where id == 1 } - // NB: usually updated_time_mod.created != t, because t has + // Note: usually updated_time_mod.created != t, because t has // its microseconds set, while the value retrieved from the DB // has them zeroed, because the db field resolution is seconds. assert updated_time_mod.created.format_ss() == t.format_ss() diff --git a/vlib/os/environment.c.v b/vlib/os/environment.c.v index fe057f04f..ed7468114 100644 --- a/vlib/os/environment.c.v +++ b/vlib/os/environment.c.v @@ -36,7 +36,7 @@ pub fn getenv_opt(key string) ?string { if s == voidptr(0) { return none } - // NB: C.getenv *requires* that the result be copied. + // Note: C.getenv *requires* that the result be copied. return cstring_to_vstring(s) } } diff --git a/vlib/os/file.c.v b/vlib/os/file.c.v index 878cc0ac8..9d5df8adb 100644 --- a/vlib/os/file.c.v +++ b/vlib/os/file.c.v @@ -102,7 +102,7 @@ pub fn open(path string) ?File { // create creates or opens a file at a specified location and returns a write-only `File` object. pub fn create(path string) ?File { /* - // NB: android/termux/bionic is also a kind of linux, + // Note: android/termux/bionic is also a kind of linux, // but linux syscalls there sometimes fail, // while the libc version should work. $if linux { @@ -264,7 +264,7 @@ pub fn (mut f File) write_to(pos u64, buf []byte) ?int { } // write_ptr writes `size` bytes to the file, starting from the address in `data`. -// NB: write_ptr is unsafe and should be used carefully, since if you pass invalid +// Note: write_ptr is unsafe and should be used carefully, since if you pass invalid // pointers to it, it will cause your programs to segfault. [unsafe] pub fn (mut f File) write_ptr(data voidptr, size int) int { @@ -297,7 +297,7 @@ pub fn (mut f File) write_full_buffer(buffer voidptr, buffer_len usize) ? { // write_ptr_at writes `size` bytes to the file, starting from the address in `data`, // at byte offset `pos`, counting from the start of the file (pos 0). -// NB: write_ptr_at is unsafe and should be used carefully, since if you pass invalid +// Note: write_ptr_at is unsafe and should be used carefully, since if you pass invalid // pointers to it, it will cause your programs to segfault. [unsafe] pub fn (mut f File) write_ptr_at(data voidptr, size int, pos u64) int { diff --git a/vlib/os/os.c.v b/vlib/os/os.c.v index 7ece54b24..8caaa7577 100644 --- a/vlib/os/os.c.v +++ b/vlib/os/os.c.v @@ -258,7 +258,7 @@ pub fn cp(src string, dst string) ? { } // vfopen returns an opened C file, given its path and open mode. -// NB: os.vfopen is useful for compatibility with C libraries, that expect `FILE *`. +// Note: os.vfopen is useful for compatibility with C libraries, that expect `FILE *`. // If you write pure V code, os.create or os.open are more convenient. pub fn vfopen(path string, mode string) ?&C.FILE { if path.len == 0 { @@ -397,7 +397,7 @@ pub fn exists(path string) bool { // is_executable returns `true` if `path` is executable. pub fn is_executable(path string) bool { $if windows { - // NB: https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/access-waccess?view=vs-2019 + // Note: https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/access-waccess?view=vs-2019 // i.e. there is no X bit there, the modes can be: // 00 Existence only // 02 Write-only @@ -781,7 +781,7 @@ pub fn getwd() string { // See http://pubs.opengroup.org/onlinepubs/9699919799/functions/realpath.html // Also https://insanecoding.blogspot.com/2007/11/pathmax-simply-isnt.html // and https://insanecoding.blogspot.com/2007/11/implementing-realpath-in-c.html -// NB: this particular rabbit hole is *deep* ... +// Note: this particular rabbit hole is *deep* ... [manualfree] pub fn real_path(fpath string) string { size := max_path_bufffer_size() @@ -833,7 +833,7 @@ pub fn real_path(fpath string) string { unsafe { res.free() } return fpath.clone() } - // NB: fullpath is much larger (usually ~4KB), than what C.realpath will + // Note: fullpath is much larger (usually ~4KB), than what C.realpath will // actually fill in the vast majority of the cases => it pays to copy the // resulting string from that buffer, to a shorter one, and then free the // 4KB fullpath buffer. @@ -946,7 +946,7 @@ pub fn open_append(path string) ?File { // execvp - loads and executes a new child process, *in place* of the current process. // The child process executable is located in `cmdpath`. // The arguments, that will be passed to it are in `args`. -// NB: this function will NOT return when successfull, since +// Note: this function will NOT return when successfull, since // the child process will take control over execution. pub fn execvp(cmdpath string, cmdargs []string) ? { mut cargs := []&char{} @@ -972,7 +972,7 @@ pub fn execvp(cmdpath string, cmdargs []string) ? { // The child process executable is located in `cmdpath`. // The arguments, that will be passed to it are in `args`. // You can pass environment variables to through `envs`. -// NB: this function will NOT return when successfull, since +// Note: this function will NOT return when successfull, since // the child process will take control over execution. pub fn execve(cmdpath string, cmdargs []string, envs []string) ? { mut cargv := []&char{} @@ -992,7 +992,7 @@ pub fn execve(cmdpath string, cmdargs []string, envs []string) ? { } $else { res = C.execve(&char(cmdpath.str), cargv.data, cenvs.data) } - // NB: normally execve does not return at all. + // Note: normally execve does not return at all. // If it returns, then something went wrong... if res == -1 { return error_with_code(posix_get_error_msg(C.errno), C.errno) diff --git a/vlib/os/os.js.v b/vlib/os/os.js.v index 916083c21..0ff0faea4 100644 --- a/vlib/os/os.js.v +++ b/vlib/os/os.js.v @@ -38,7 +38,7 @@ fn init() { // See http://pubs.opengroup.org/onlinepubs/9699919799/functions/realpath.html // Also https://insanecoding.blogspot.com/2007/11/pathmax-simply-isnt.html // and https://insanecoding.blogspot.com/2007/11/implementing-realpath-in-c.html -// NB: this particular rabbit hole is *deep* ... +// Note: this particular rabbit hole is *deep* ... pub fn real_path(fpath string) string { $if js_node { mut res := '' diff --git a/vlib/os/os.v b/vlib/os/os.v index ea8a9d7dd..bf233bcdd 100644 --- a/vlib/os/os.v +++ b/vlib/os/os.v @@ -283,7 +283,7 @@ pub fn get_lines_joined() string { } // get_raw_lines_joined reads *all* input lines from stdin. -// It returns them as one large string. NB: unlike os.get_lines_joined, +// It returns them as one large string. Note: unlike os.get_lines_joined, // empty lines (that contain only `\r\n` or `\n`), will be present in // the output. // Reading is stopped, only on EOF of stdin. diff --git a/vlib/os/os_nix.c.v b/vlib/os/os_nix.c.v index 883e636f6..9d855f34c 100644 --- a/vlib/os/os_nix.c.v +++ b/vlib/os/os_nix.c.v @@ -53,7 +53,7 @@ fn C.link(&char, &char) int fn C.gethostname(&char, int) int -// NB: not available on Android fn C.getlogin_r(&char, int) int +// Note: not available on Android fn C.getlogin_r(&char, int) int fn C.getlogin() &char fn C.getppid() int diff --git a/vlib/os/os_test.v b/vlib/os/os_test.v index 6324e5415..d527b6bd2 100644 --- a/vlib/os/os_test.v +++ b/vlib/os/os_test.v @@ -357,7 +357,7 @@ fn test_mv() { fn test_cp_all() { // fileX -> dir/fileX - // NB: clean up of the files happens inside the cleanup_leftovers function + // Note: clean up of the files happens inside the cleanup_leftovers function os.write_file('ex1.txt', 'wow!') or { panic(err) } os.mkdir('ex') or { panic(err) } os.cp_all('ex1.txt', 'ex', false) or { panic(err) } @@ -749,7 +749,7 @@ fn test_posix_set_bit() ? { } mode = u32(s.st_mode) & 0o0777 assert mode == 0o0777 - // NB: setting the sticky bit is platform dependend + // Note: setting the sticky bit is platform dependend // `chmod -s -g -t` os.posix_set_permission_bit(fpath, os.s_isuid, false) os.posix_set_permission_bit(fpath, os.s_isgid, false) diff --git a/vlib/os/process.c.v b/vlib/os/process.c.v index c7e2b981e..293f11837 100644 --- a/vlib/os/process.c.v +++ b/vlib/os/process.c.v @@ -40,10 +40,10 @@ pub fn (mut p Process) signal_continue() { } // wait - wait for a process to finish. -// NB: You have to call p.wait(), otherwise a finished process +// Note: You have to call p.wait(), otherwise a finished process // would get to a zombie state, and its resources will not get // released fully, until its parent process exits. -// NB: This call will block the calling process until the child +// Note: This call will block the calling process until the child // process is finished. pub fn (mut p Process) wait() { if p.status == .not_started { diff --git a/vlib/os/process.js.v b/vlib/os/process.js.v index 22e1310ce..d1b8338d5 100644 --- a/vlib/os/process.js.v +++ b/vlib/os/process.js.v @@ -5,7 +5,7 @@ $if js_node { } // new_process - create a new process descriptor -// NB: new does NOT start the new process. +// Note: new does NOT start the new process. // That is done because you may want to customize it first, // by calling different set_ methods on it. // In order to start it, call p.run() or p.wait() diff --git a/vlib/os/process.v b/vlib/os/process.v index fee85d841..9ec776abd 100644 --- a/vlib/os/process.v +++ b/vlib/os/process.v @@ -36,7 +36,7 @@ pub mut: } // new_process - create a new process descriptor -// NB: new does NOT start the new process. +// Note: new does NOT start the new process. // That is done because you may want to customize it first, // by calling different set_ methods on it. // In order to start it, call p.run() or p.wait() diff --git a/vlib/os/process_nix.c.v b/vlib/os/process_nix.c.v index ad37aaee1..c063a7b8b 100644 --- a/vlib/os/process_nix.c.v +++ b/vlib/os/process_nix.c.v @@ -13,7 +13,7 @@ fn (mut p Process) unix_spawn_process() int { pid := fork() if pid != 0 { // This is the parent process after the fork. - // NB: pid contains the process ID of the child process + // Note: pid contains the process ID of the child process if p.use_stdio_ctl { p.stdio_fd[0] = pipeset[1] // store the write end of child's in p.stdio_fd[1] = pipeset[2] // store the read end of child's out diff --git a/vlib/os/signal.v b/vlib/os/signal.v index 03bd88d38..08a2c2280 100644 --- a/vlib/os/signal.v +++ b/vlib/os/signal.v @@ -2,7 +2,7 @@ module os // os.Signal - enumerate possible POSIX signals and // their integer codes. -// NB: the integer codes are given here explicitly, +// Note: the integer codes are given here explicitly, // to make it easier to lookup, without needing to // consult man pages / signal.h . diff --git a/vlib/rand/rand.c.v b/vlib/rand/rand.c.v index 2ebb64c83..338b01377 100644 --- a/vlib/rand/rand.c.v +++ b/vlib/rand/rand.c.v @@ -56,7 +56,7 @@ const ulid_encoding = '0123456789ABCDEFGHJKMNPQRSTVWXYZ' // ulid generates an Unique Lexicographically sortable IDentifier. // See https://github.com/ulid/spec . -// NB: ULIDs can leak timing information, if you make them public, because +// Note: ULIDs can leak timing information, if you make them public, because // you can infer the rate at which some resource is being created, like // users or business transactions. // (https://news.ycombinator.com/item?id=14526173) diff --git a/vlib/rand/rand.js.v b/vlib/rand/rand.js.v index 28f452593..969c0fee9 100644 --- a/vlib/rand/rand.js.v +++ b/vlib/rand/rand.js.v @@ -24,7 +24,7 @@ const ( // ulid generates an Unique Lexicographically sortable IDentifier. // See https://github.com/ulid/spec . -// NB: ULIDs can leak timing information, if you make them public, because +// Note: ULIDs can leak timing information, if you make them public, because // you can infer the rate at which some resource is being created, like // users or business transactions. // (https://news.ycombinator.com/item?id=14526173) diff --git a/vlib/stbi/link_to_libm.c.v b/vlib/stbi/link_to_libm.c.v index 6630fe135..1f3e04d3d 100644 --- a/vlib/stbi/link_to_libm.c.v +++ b/vlib/stbi/link_to_libm.c.v @@ -3,7 +3,7 @@ // that can be found in the LICENSE file. module stbi -// NB: stbi uses math.h because of `ldexp` and `pow`, for which we *do* have +// Note: stbi uses math.h because of `ldexp` and `pow`, for which we *do* have // pure V implementations, but our `math` module still depends on libm // because of 'powf', 'cosf', 'sinf', 'sqrtf' and 'tanf'. diff --git a/vlib/strings/builder.c.v b/vlib/strings/builder.c.v index 52c313a9f..ce0d0cf7b 100644 --- a/vlib/strings/builder.c.v +++ b/vlib/strings/builder.c.v @@ -79,7 +79,7 @@ pub fn (mut b Builder) drain_builder(mut other Builder, other_new_cap int) { } // byte_at returns a byte, located at a given index `i`. -// NB: it can panic, if there are not enough bytes in the strings builder yet. +// Note: it can panic, if there are not enough bytes in the strings builder yet. [inline] pub fn (b &Builder) byte_at(n int) byte { return unsafe { (&[]byte(b))[n] } @@ -123,7 +123,7 @@ pub fn (mut b Builder) cut_to(pos int) string { } // go_back_to resets the buffer to the given position `pos` -// NB: pos should be < than the existing buffer length. +// Note: pos should be < than the existing buffer length. pub fn (mut b Builder) go_back_to(pos int) { b.trim(pos) } @@ -162,7 +162,7 @@ pub fn (b &Builder) after(n int) string { } // str returns a copy of all of the accumulated buffer content. -// NB: after a call to b.str(), the builder b should not be +// Note: after a call to b.str(), the builder b should not be // used again, you need to call b.free() first, or just leave // it to be freed by -autofree when it goes out of scope. // The returned string *owns* its own separate copy of the diff --git a/vlib/strings/strings.c.v b/vlib/strings/strings.c.v index c020f5b40..a07f34502 100644 --- a/vlib/strings/strings.c.v +++ b/vlib/strings/strings.c.v @@ -14,7 +14,7 @@ pub fn repeat(c byte, n int) string { } // strings.repeat_string - gives you `n` repetitions of the substring `s` -// NB: strings.repeat, that repeats a single byte, is between 2x +// Note: strings.repeat, that repeats a single byte, is between 2x // and 24x faster than strings.repeat_string called for a 1 char string. pub fn repeat_string(s string, n int) string { if n <= 0 || s.len == 0 { diff --git a/vlib/strings/textscanner/textscanner.v b/vlib/strings/textscanner/textscanner.v index 55251373b..76104fe50 100644 --- a/vlib/strings/textscanner/textscanner.v +++ b/vlib/strings/textscanner/textscanner.v @@ -129,7 +129,7 @@ pub fn (ss &TextScanner) peek_back_n(n int) int { // current returns the current character code from the input text. // current returns `-1` at the start of the input text. -// NB: after `c := ts.next()`, `ts.current()` will also return `c`. +// Note: after `c := ts.next()`, `ts.current()` will also return `c`. [direct_array_access; inline] pub fn (mut ss TextScanner) current() int { if ss.pos > 0 { diff --git a/vlib/sync/bench/many_writers_and_receivers_on_1_channel.v b/vlib/sync/bench/many_writers_and_receivers_on_1_channel.v index 999bb1dfa..e1cd96872 100644 --- a/vlib/sync/bench/many_writers_and_receivers_on_1_channel.v +++ b/vlib/sync/bench/many_writers_and_receivers_on_1_channel.v @@ -39,7 +39,7 @@ fn do_rec(ch chan int, id int, mut ctx Context) { mut timer_sw_x := time.new_stopwatch() mut tmp := int(0) mut i := int(0) - // NB: a single receiver thread can get slightly more + // Note: a single receiver thread can get slightly more // than its fair share of sends, that is why // the receiver's Event array is much larger, // enough so a single receiver can potentially process all diff --git a/vlib/sync/once_with_param_test.v b/vlib/sync/once_with_param_test.v index ededa1e69..523bac4ed 100644 --- a/vlib/sync/once_with_param_test.v +++ b/vlib/sync/once_with_param_test.v @@ -1,6 +1,6 @@ import sync -// NB: this is the same test as `vlib/sync/once_test.v`, but +// Note: this is the same test as `vlib/sync/once_test.v`, but // it uses an explicit passing of the voidptr parameter in // once.do_with_param/2, instead of passing a closure of it // in once.do/1. diff --git a/vlib/sync/pool/pool_test.v b/vlib/sync/pool/pool_test.v index eabaeda82..d89193418 100644 --- a/vlib/sync/pool/pool_test.v +++ b/vlib/sync/pool/pool_test.v @@ -42,7 +42,7 @@ fn test_work_on_strings() { } fn test_work_on_ints() { - // NB: since maxjobs is left empty here, + // Note: since maxjobs is left empty here, // the pool processor will use njobs = runtime.nr_jobs so that // it will work optimally without overloading the system mut pool_i := pool.new_pool_processor( diff --git a/vlib/sync/stdatomic/atomic.c.v b/vlib/sync/stdatomic/atomic.c.v index 4d67ac50c..75274a0b1 100644 --- a/vlib/sync/stdatomic/atomic.c.v +++ b/vlib/sync/stdatomic/atomic.c.v @@ -5,7 +5,7 @@ module stdatomic // // On windows tcc can simulate with other atomic operations. // -// NB: this implementations should be regarded as alpha stage and be tested +// Note: this implementations should be regarded as alpha stage and be tested // much more. // add_u64 adds provided delta as an atomic operation diff --git a/vlib/sync/stdatomic/atomic_test.v b/vlib/sync/stdatomic/atomic_test.v index b12098d30..0d8b15a71 100644 --- a/vlib/sync/stdatomic/atomic_test.v +++ b/vlib/sync/stdatomic/atomic_test.v @@ -32,7 +32,7 @@ fn test_count_10_times_1_cycle_should_not_be_10_cycles_without_sync() { go count_one_cycle_without_sync(mut counter, mut wg) } wg.wait() - // NB: we do not assert here, just print, because sometimes by chance counter.counter may be == desired_iterations + // Note: we do not assert here, just print, because sometimes by chance counter.counter may be == desired_iterations eprintln('without synchronization the counter is: ${counter.counter:10} , expectedly != ${desired_iterations:10}') } diff --git a/vlib/sync/threads/threads.c.v b/vlib/sync/threads/threads.c.v index 02506c20c..d04fe2f8c 100644 --- a/vlib/sync/threads/threads.c.v +++ b/vlib/sync/threads/threads.c.v @@ -5,7 +5,7 @@ module threads // See vlib/v/parser/pratt.v, search for ast.GoExpr . // The goal is that programs, that do not use threads at all will not need // to link to -lpthread etc. -// NB: on some platforms like Android, linking -lpthread is not needed too. +// Note: on some platforms like Android, linking -lpthread is not needed too. // See https://stackoverflow.com/a/31277163/1904615 $if !windows && !android { diff --git a/vlib/time/Y2K38_test.v b/vlib/time/Y2K38_test.v index 0ebc0ef92..c44120a5e 100644 --- a/vlib/time/Y2K38_test.v +++ b/vlib/time/Y2K38_test.v @@ -6,7 +6,7 @@ fn test_time_after_2038_works() { error_time := after_time.add_days(180) dump(error_time) assert error_time.str() == '2038-01-19 00:00:00' - // NB: the next date is after Y2K38, it should NOT wrap: + // Note: the next date is after Y2K38, it should NOT wrap: error_time2 := after_time.add_days(181) dump(error_time2) assert error_time2.str() == '2038-01-20 00:00:00' diff --git a/vlib/time/stopwatch_test.v b/vlib/time/stopwatch_test.v index 49d005a55..604386448 100644 --- a/vlib/time/stopwatch_test.v +++ b/vlib/time/stopwatch_test.v @@ -1,6 +1,6 @@ import time -// NB: on CI jobs, especially msvc ones, sleep_ms may sleep for much more +// Note: on CI jobs, especially msvc ones, sleep_ms may sleep for much more // time than you have specified. To avoid false positives from CI test // failures, some of the asserts will be run only if you pass `-d stopwatch` fn test_stopwatch_works_as_intended() { diff --git a/vlib/time/time_darwin.c.v b/vlib/time/time_darwin.c.v index db8b9bb33..adcc0fbda 100644 --- a/vlib/time/time_darwin.c.v +++ b/vlib/time/time_darwin.c.v @@ -47,7 +47,7 @@ fn sys_mono_now_darwin() u64 { return (tm - time.start_time) * time.time_base.numer / time.time_base.denom } -// NB: vpc_now_darwin is used by `v -profile` . +// Note: vpc_now_darwin is used by `v -profile` . // It should NOT call *any other v function*, just C functions and casts. [inline] fn vpc_now_darwin() u64 { diff --git a/vlib/time/time_nix.c.v b/vlib/time/time_nix.c.v index 0a371597f..5d88b6ff8 100644 --- a/vlib/time/time_nix.c.v +++ b/vlib/time/time_nix.c.v @@ -57,7 +57,7 @@ pub fn sys_mono_now() u64 { } } -// NB: vpc_now is used by `v -profile` . +// Note: vpc_now is used by `v -profile` . // It should NOT call *any other v function*, just C functions and casts. [inline] fn vpc_now() u64 { diff --git a/vlib/time/time_windows.c.v b/vlib/time/time_windows.c.v index 5795ce898..0b676db4d 100644 --- a/vlib/time/time_windows.c.v +++ b/vlib/time/time_windows.c.v @@ -79,7 +79,7 @@ pub fn sys_mono_now() u64 { return (tm - time.start_time) * 1000000000 / time.freq_time } -// NB: vpc_now is used by `v -profile` . +// Note: vpc_now is used by `v -profile` . // It should NOT call *any other v function*, just C functions and casts. [inline] fn vpc_now() u64 { diff --git a/vlib/toml/tests/burntsushi.toml-test_test.v b/vlib/toml/tests/burntsushi.toml-test_test.v index 7dd6be207..346efa83a 100644 --- a/vlib/toml/tests/burntsushi.toml-test_test.v +++ b/vlib/toml/tests/burntsushi.toml-test_test.v @@ -205,7 +205,7 @@ fn to_burntsushi(value ast.Value) string { // Normalization for json json_text := json2.Any(value.text).json_str().to_upper().replace(' ', 'T') - // NB: Since encoding strings in JSON now automatically includes quotes, + // Note: Since encoding strings in JSON now automatically includes quotes, // I added a somewhat a workaround by adding an ending quote in order to // recognize properly the date time type. - Ned typ := if json_text.ends_with('Z"') || json_text.all_after('T').contains('-') diff --git a/vlib/toml/tests/iarna.toml-spec-tests_test.v b/vlib/toml/tests/iarna.toml-spec-tests_test.v index 9f8476284..cb8f1fcf2 100644 --- a/vlib/toml/tests/iarna.toml-spec-tests_test.v +++ b/vlib/toml/tests/iarna.toml-spec-tests_test.v @@ -321,7 +321,7 @@ fn to_iarna(value ast.Value, skip_value_map bool) string { } ast.Time { mut json_text := json2.Any(value.text).json_str() - // NB: Removes the quotes of the encoded JSON string - Ned + // Note: Removes the quotes of the encoded JSON string - Ned json_text = to_iarna_time(json_text[1..json_text.len - 1]) if skip_value_map { return json_text diff --git a/vlib/v/ast/ast.v b/vlib/v/ast/ast.v index 4295687f6..795bf4260 100644 --- a/vlib/v/ast/ast.v +++ b/vlib/v/ast/ast.v @@ -1700,7 +1700,7 @@ pub fn (expr Expr) is_blank_ident() bool { pub fn (expr Expr) pos() token.Pos { // all uncommented have to be implemented - // NB: please do not print here. the language server will hang + // Note: please do not print here. the language server will hang // as it uses STDIO primarly to communicate ~Ned match expr { AnonFn { @@ -2002,7 +2002,7 @@ pub fn (node Node) children() []Node { Return { return node.exprs.map(Node(it)) } - // NB: these four decl nodes cannot be merged as one branch + // Note: these four decl nodes cannot be merged as one branch StructDecl { return node.fields.map(Node(it)) } diff --git a/vlib/v/ast/table.v b/vlib/v/ast/table.v index e5e567ba8..564d23504 100644 --- a/vlib/v/ast/table.v +++ b/vlib/v/ast/table.v @@ -236,7 +236,7 @@ pub fn (t &Table) fn_type_source_signature(f &Fn) string { if arg.is_mut { sig += 'mut ' } - // NB: arg name is only added for fmt, else it would causes errors with generics + // Note: arg name is only added for fmt, else it would causes errors with generics if t.is_fmt && arg.name.len > 0 { sig += '$arg.name ' } diff --git a/vlib/v/ast/types.v b/vlib/v/ast/types.v index 265354821..46cedbcc3 100644 --- a/vlib/v/ast/types.v +++ b/vlib/v/ast/types.v @@ -168,7 +168,7 @@ pub fn (t Type) nr_muls() int { [inline] pub fn (t Type) is_ptr() bool { // any normal pointer, i.e. &Type, &&Type etc; - // NB: voidptr, charptr and byteptr are NOT included! + // Note: voidptr, charptr and byteptr are NOT included! return (int(t) >> 16) & 0xff > 0 } @@ -427,7 +427,7 @@ pub const ( u8_type_idx = 30 ) -// NB: builtin_type_names must be in the same order as the idx consts above +// Note: builtin_type_names must be in the same order as the idx consts above pub const builtin_type_names = ['void', 'voidptr', 'byteptr', 'charptr', 'i8', 'i16', 'int', 'i64', 'isize', 'byte', 'u16', 'u32', 'u64', 'usize', 'f32', 'f64', 'char', 'bool', 'none', 'string', 'rune', 'array', 'map', 'chan', 'any', 'float_literal', 'int_literal', 'thread', 'Error', 'u8'] diff --git a/vlib/v/builder/builder.v b/vlib/v/builder/builder.v index 8b88d8cad..266b0c8c5 100644 --- a/vlib/v/builder/builder.v +++ b/vlib/v/builder/builder.v @@ -36,7 +36,7 @@ pub mut: table &ast.Table ccoptions CcompilerOptions // - // NB: changes in mod `builtin` force invalidation of every other .v file + // Note: changes in mod `builtin` force invalidation of every other .v file mod_invalidates_paths map[string][]string // changes in mod `os`, invalidate only .v files, that do `import os` mod_invalidates_mods map[string][]string // changes in mod `os`, force invalidation of mods, that do `import os` path_invalidates_mods map[string][]string // changes in a .v file from `os`, invalidates `os` @@ -153,7 +153,7 @@ pub fn (mut b Builder) parse_imports() { done_imports << file.mod.name } } - // NB: b.parsed_files is appended in the loop, + // Note: b.parsed_files is appended in the loop, // so we can not use the shorter `for in` form. for i := 0; i < b.parsed_files.len; i++ { ast_file := b.parsed_files[i] diff --git a/vlib/v/builder/cc.v b/vlib/v/builder/cc.v index 43f1fb0e8..25a1b913f 100644 --- a/vlib/v/builder/cc.v +++ b/vlib/v/builder/cc.v @@ -662,7 +662,7 @@ pub fn (mut v Builder) cc() { println('strip failed') return } - // NB: upx --lzma can sometimes fail with NotCompressibleException + // Note: upx --lzma can sometimes fail with NotCompressibleException // See https://github.com/vlang/v/pull/3528 mut ret2 := os.system('upx --lzma -qqq $v.pref.out_name') if ret2 != 0 { diff --git a/vlib/v/builder/msvc.v b/vlib/v/builder/msvc.v index 1a3b49643..eb630e5a4 100644 --- a/vlib/v/builder/msvc.v +++ b/vlib/v/builder/msvc.v @@ -446,7 +446,7 @@ fn (mut v Builder) build_thirdparty_obj_file_with_msvc(path string, moduleflags } str_oargs := oargs.join(' ') cmd := '"$msvc.full_cl_exe_path" /volatile:ms $str_oargs $defines $include_string /c "$cfile" /Fo"$obj_path"' - // NB: the quotes above ARE balanced. + // Note: the quotes above ARE balanced. $if trace_thirdparty_obj_files ? { println('>>> build_thirdparty_obj_file_with_msvc cmd: $cmd') } @@ -496,7 +496,7 @@ pub fn msvc_string_flags(cflags []cflag.CFlag) MsvcStringFlags { lib_paths << flag.value + os.path_separator + 'msvc' // The above allows putting msvc specific .lib files in a subfolder msvc/ , // where gcc will NOT find them, but cl will do... - // NB: gcc is smart enough to not need .lib files at all in most cases, the .dll is enough. + // Note: gcc is smart enough to not need .lib files at all in most cases, the .dll is enough. // When both a msvc .lib file and .dll file are present in the same folder, // as for example for glfw3, compilation with gcc would fail. } else if flag.value.ends_with('.o') { diff --git a/vlib/v/checker/fn.v b/vlib/v/checker/fn.v index 994b65c03..15177508f 100644 --- a/vlib/v/checker/fn.v +++ b/vlib/v/checker/fn.v @@ -832,7 +832,7 @@ pub fn (mut c Checker) fn_call(mut node ast.CallExpr, mut continue_check &bool) final_param_typ = param_typ_sym.array_info().elem_type final_param_sym = c.table.sym(final_param_typ) } - // NB: Casting to voidptr is used as an escape mechanism, so: + // Note: Casting to voidptr is used as an escape mechanism, so: // 1. allow passing *explicit* voidptr (native or through cast) to functions // expecting voidptr or ...voidptr // ... but 2. disallow passing non-pointers - that is very rarely what the user wanted, diff --git a/vlib/v/checker/return.v b/vlib/v/checker/return.v index e9ea15a2d..82ac175db 100644 --- a/vlib/v/checker/return.v +++ b/vlib/v/checker/return.v @@ -175,7 +175,7 @@ pub fn (mut c Checker) find_unreachable_statements_after_noreturn_calls(stmts [] } } -// NB: has_top_return/1 should be called on *already checked* stmts, +// Note: has_top_return/1 should be called on *already checked* stmts, // which do have their stmt.expr.is_noreturn set properly: fn has_top_return(stmts []ast.Stmt) bool { for stmt in stmts { diff --git a/vlib/v/checker/tests/modules/deprecated_module/main.v b/vlib/v/checker/tests/modules/deprecated_module/main.v index 1164fde86..e2bbe8b08 100644 --- a/vlib/v/checker/tests/modules/deprecated_module/main.v +++ b/vlib/v/checker/tests/modules/deprecated_module/main.v @@ -2,7 +2,7 @@ import bbb.ccc import www.ttt import xxx.yyy -// NB: www.ttt has been deprecated. +// Note: www.ttt has been deprecated. // => compiling this should produce an error, // showing the deprecation message fn main() { diff --git a/vlib/v/compiler_errors_test.v b/vlib/v/compiler_errors_test.v index c189afab7..fd82bdc68 100644 --- a/vlib/v/compiler_errors_test.v +++ b/vlib/v/compiler_errors_test.v @@ -106,7 +106,7 @@ fn test_all() { // if github_job == 'ubuntu-tcc' { // This is done with tcc only, because the error output is compiler specific. - // NB: the tasks should be run serially, since they depend on + // Note: the tasks should be run serially, since they depend on // setting and using environment variables. mut cte_tasks := Tasks{ vexe: vexe @@ -200,7 +200,7 @@ fn (mut tasks Tasks) run() { m_skip_files = [] } $if tinyc { - // NB: tcc does not support __has_include, so the detection mechanism + // Note: tcc does not support __has_include, so the detection mechanism // used for the other compilers does not work. It still provides a // cleaner error message, than a generic C error, but without the explanation. m_skip_files << 'vlib/v/checker/tests/missing_c_lib_header_1.vv' @@ -298,7 +298,7 @@ fn work_processor(mut work sync.Channel, mut results sync.Channel) { } } -// actual processing; NB: no output is done here at all +// actual processing; Note: no output is done here at all fn (mut task TaskDescription) execute() { if task.is_skipped { return diff --git a/vlib/v/doc/module.v b/vlib/v/doc/module.v index 5ac87dbc4..021ba895e 100644 --- a/vlib/v/doc/module.v +++ b/vlib/v/doc/module.v @@ -10,7 +10,7 @@ import v.pref // that either contains main .v files, or a v.mod file is reached. // For example, given something like /languages/v/vlib/x/websocket/tests/autobahn // it returns `x.websocket.tests`, because /languages/v/ has v.mod file in it. -// NB: calling this is expensive, so keep the result, instead of recomputing it. +// Note: calling this is expensive, so keep the result, instead of recomputing it. // TODO: turn this to a Doc method, so that the new_vdoc_preferences call here can // be removed. fn get_parent_mod(input_dir string) ?string { diff --git a/vlib/v/embed_file/embed_file.v b/vlib/v/embed_file/embed_file.v index 26fc834e8..730cc3180 100644 --- a/vlib/v/embed_file/embed_file.v +++ b/vlib/v/embed_file/embed_file.v @@ -95,7 +95,7 @@ pub fn (mut ed EmbedFileData) data() &byte { // program that uses $embed_file('file.bin') in -prod mode. // V will generate a static index of all embedded files, and will call the // find_index_entry_by_path over the index and the relative paths of the embeds. -// NB: these are public on purpose, to help -usecache. +// Note: these are public on purpose, to help -usecache. pub struct EmbedFileIndexEntry { id int path string diff --git a/vlib/v/eval/object.v b/vlib/v/eval/object.v index 3373d684b..528381c27 100644 --- a/vlib/v/eval/object.v +++ b/vlib/v/eval/object.v @@ -2,7 +2,7 @@ module eval const empty = Void{} -// NB: i64 is an int_literal, NOT an i64 (same with f64) +// Note: i64 is an int_literal, NOT an i64 (same with f64) type Object = Array | Float | Int diff --git a/vlib/v/fmt/fmt.v b/vlib/v/fmt/fmt.v index 82c5c3564..7d90e8ce8 100644 --- a/vlib/v/fmt/fmt.v +++ b/vlib/v/fmt/fmt.v @@ -25,7 +25,7 @@ pub mut: out_imports strings.Builder indent int empty_line bool - line_len int // the current line length, NB: it counts \t as 4 spaces, and starts at 0 after f.writeln + line_len int // the current line length, Note: it counts \t as 4 spaces, and starts at 0 after f.writeln buffering bool // disables line wrapping for exprs that will be analyzed later par_level int // how many parentheses are put around the current expression array_init_break []bool // line breaks after elements in hierarchy level of multi dimensional array diff --git a/vlib/v/gen/c/auto_str_methods.v b/vlib/v/gen/c/auto_str_methods.v index b149d52b4..cba6fd9c9 100644 --- a/vlib/v/gen/c/auto_str_methods.v +++ b/vlib/v/gen/c/auto_str_methods.v @@ -617,7 +617,7 @@ fn (mut g Gen) gen_str_for_array(info ast.Array, styp string, str_fn_name string } } else { // There is a custom .str() method, so use it. - // NB: we need to take account of whether the user has defined + // Note: we need to take account of whether the user has defined // `fn (x T) str() {` or `fn (x &T) str() {`, and convert accordingly deref, deref_label := deref_kind(str_method_expects_ptr, is_elem_ptr, typ) g.auto_str_funcs.writeln('\t\tstrings__Builder_write_string(&sb, _SLIT("$deref_label"));') diff --git a/vlib/v/gen/c/cgen.v b/vlib/v/gen/c/cgen.v index bbe60bcf2..4aea8788f 100644 --- a/vlib/v/gen/c/cgen.v +++ b/vlib/v/gen/c/cgen.v @@ -15,7 +15,7 @@ import v.depgraph import sync.pool const ( - // NB: some of the words in c_reserved, are not reserved in C, + // Note: some of the words in c_reserved, are not reserved in C, // but are in C++, or have special meaning in V, thus need escaping too. // `small` should not be needed, but see: https://stackoverflow.com/questions/5874215/what-is-rpcndr-h c_reserved = ['array', 'auto', 'bool', 'break', 'calloc', 'case', 'char', 'class', 'complex', @@ -2001,7 +2001,7 @@ fn (mut g Gen) call_cfn_for_casting_expr(fname string, expr ast.Expr, exp_is_ptr if !got_is_ptr { if !expr.is_lvalue() || (expr is ast.Ident && (expr as ast.Ident).obj.is_simple_define_const()) { - // NB: the `_to_sumtype_` family of functions do call memdup internally, making + // Note: the `_to_sumtype_` family of functions do call memdup internally, making // another duplicate with the HEAP macro is redundant, so use ADDR instead: promotion_macro_name := if fname.contains('_to_sumtype_') { 'ADDR' } else { 'HEAP' } g.write('${promotion_macro_name}($got_styp, (') @@ -2743,7 +2743,7 @@ fn (mut g Gen) expr(node ast.Expr) { } else { g.discard_or_result = false } - // NB: please keep the type names in the match here in alphabetical order: + // Note: please keep the type names in the match here in alphabetical order: match mut node { ast.ComptimeType { g.error('g.expr(): Unhandled ComptimeType', node.pos) @@ -4144,7 +4144,7 @@ fn (mut g Gen) const_decl(node ast.ConstDecl) { } } else { - // NB: -usecache uses prebuilt modules, each compiled with: + // Note: -usecache uses prebuilt modules, each compiled with: // `v build-module vlib/module` // combined with a top level program, that is compiled with: // `v -usecache toplevel` @@ -4432,7 +4432,7 @@ fn (mut g Gen) write_init_function() { if g.pref.prealloc { g.writeln('prealloc_vinit();') } - // NB: the as_cast table should be *before* the other constant initialize calls, + // Note: the as_cast table should be *before* the other constant initialize calls, // because it may be needed during const initialization of builtin and during // calling module init functions too, just in case they do fail... g.write('\tas_cast_type_indexes = ') @@ -4481,7 +4481,7 @@ fn (mut g Gen) write_init_function() { // shared libraries need a way to call _vinit/2. For that purpose, // provide a constructor/destructor pair, ensuring that all constants // are initialized just once, and that they will be freed too. - // NB: os.args in this case will be []. + // Note: os.args in this case will be []. g.writeln('__attribute__ ((constructor))') g.writeln('void _vinit_caller() {') g.writeln('\tstatic bool once = false; if (once) {return;} once = true;') @@ -5463,7 +5463,7 @@ fn (mut g Gen) interface_table() string { mut methods_wrapper := strings.new_builder(100) methods_wrapper.writeln('// Methods wrapper for interface "$interface_name"') mut already_generated_mwrappers := map[string]int{} - iinidx_minimum_base := 1000 // NB: NOT 0, to avoid map entries set to 0 later, so `if already_generated_mwrappers[name] > 0 {` works. + iinidx_minimum_base := 1000 // Note: NOT 0, to avoid map entries set to 0 later, so `if already_generated_mwrappers[name] > 0 {` works. mut current_iinidx := iinidx_minimum_base for st in inter_info.types { st_sym := g.table.sym(st) diff --git a/vlib/v/gen/c/cheaders.v b/vlib/v/gen/c/cheaders.v index 2bf49a243..c7117e1c1 100644 --- a/vlib/v/gen/c/cheaders.v +++ b/vlib/v/gen/c/cheaders.v @@ -3,7 +3,7 @@ module c import strings import v.pref -// NB: @@@ here serve as placeholders. +// Note: @@@ here serve as placeholders. // They will be replaced with correct strings // for each constant, during C code generation. @@ -77,7 +77,7 @@ fn arm32_bytes(nargs int) string { } // gen_amd64_bytecode generates the amd64 bytecode a closure with `nargs` parameters. -// NB: `nargs` includes the last `userdata` parameter that will be passed to the original +// Note: `nargs` includes the last `userdata` parameter that will be passed to the original // function, and as such nargs must always be > 0 fn amd64_bytes(nargs int) string { match nargs { diff --git a/vlib/v/gen/c/cmain.v b/vlib/v/gen/c/cmain.v index 979d20649..feb421597 100644 --- a/vlib/v/gen/c/cmain.v +++ b/vlib/v/gen/c/cmain.v @@ -59,7 +59,7 @@ fn (mut g Gen) gen_c_main_function_header() { } // GUI application g.writeln('int WINAPI wWinMain(HINSTANCE instance, HINSTANCE prev_instance, LPWSTR cmd_line, int show_cmd){') - g.writeln('\tLPWSTR full_cmd_line = GetCommandLineW(); // NB: do not use cmd_line') + g.writeln('\tLPWSTR full_cmd_line = GetCommandLineW(); // Note: do not use cmd_line') g.writeln('\ttypedef LPWSTR*(WINAPI *cmd_line_to_argv)(LPCWSTR, int*);') g.writeln('\tHMODULE shell32_module = LoadLibrary(L"shell32.dll");') g.writeln('\tcmd_line_to_argv CommandLineToArgvW = (cmd_line_to_argv)GetProcAddress(shell32_module, "CommandLineToArgvW");') diff --git a/vlib/v/gen/c/fn.v b/vlib/v/gen/c/fn.v index df1dbcdc2..56b1c293f 100644 --- a/vlib/v/gen/c/fn.v +++ b/vlib/v/gen/c/fn.v @@ -498,7 +498,7 @@ fn (mut g Gen) gen_anon_fn(mut node ast.AnonFn) { // ensure that nargs maps to a known entry in the __closure_thunk array // TODO make it a compile-time error (you can't call `sizeof()` inside preprocessor `#if`s) - // NB: this won't be necessary when (if) we have functions that return the machine code for + // Note: this won't be necessary when (if) we have functions that return the machine code for // an arbitrary number of arguments g.write('__closure_create($node.decl.name, __closure_check_nargs($args_size), ($ctx_struct*) memdup(&($ctx_struct){') g.indent++ diff --git a/vlib/v/gen/js/auto_str_methods.v b/vlib/v/gen/js/auto_str_methods.v index bcf0e051a..14c7fdf4e 100644 --- a/vlib/v/gen/js/auto_str_methods.v +++ b/vlib/v/gen/js/auto_str_methods.v @@ -497,7 +497,7 @@ fn (mut g JsGen) gen_str_for_array(info ast.Array, styp string, str_fn_name stri // g.definitions.writeln('\t\tstring x = str_intp(2, _MOV((StrIntpData[]){{new string("\'"), $c.si_s_code, {.d_s = it }}, {new string("\'"), 0, {.d_c = 0 }}}));\n') } else { // There is a custom .str() method, so use it. - // NB: we need to take account of whether the user has defined + // Note: we need to take account of whether the user has defined // `fn (x T) str() {` or `fn (x &T) str() {`, and convert accordingly deref, deref_label := deref_kind(str_method_expects_ptr, is_elem_ptr, typ) g.definitions.writeln('\t\tstrings__Builder_write_string(sb, new string("$deref_label"));') diff --git a/vlib/v/gen/js/builtin_types.v b/vlib/v/gen/js/builtin_types.v index a87ee6bcc..bb3a5b6fe 100644 --- a/vlib/v/gen/js/builtin_types.v +++ b/vlib/v/gen/js/builtin_types.v @@ -219,7 +219,7 @@ pub fn (mut g JsGen) doc_typ(t ast.Type) string { styp += '$name' } .enum_ { - // NB: We could declare them as TypeScript enums but TS doesn't like + // Note: We could declare them as TypeScript enums but TS doesn't like // our namespacing so these break if declared in a different module. // Until this is fixed, We need to use the type of an enum's members // rather than the enum itself, and this can only be 'number' for now diff --git a/vlib/v/gen/js/js.v b/vlib/v/gen/js/js.v index 9805cebf1..b8ab23744 100644 --- a/vlib/v/gen/js/js.v +++ b/vlib/v/gen/js/js.v @@ -854,7 +854,7 @@ fn (mut g JsGen) stmt(node ast.Stmt) { } fn (mut g JsGen) expr(node ast.Expr) { - // NB: please keep the type names in the match here in alphabetical order: + // Note: please keep the type names in the match here in alphabetical order: match mut node { ast.ComptimeType { verror('not yet implemented') @@ -2077,7 +2077,7 @@ fn (mut g JsGen) gen_struct_decl(node ast.StructDecl) { } fn (mut g JsGen) gen_array_init_expr(it ast.ArrayInit) { - // NB: Fixed arrays and regular arrays are handled the same, since fixed arrays: + // Note: Fixed arrays and regular arrays are handled the same, since fixed arrays: // 1) Are only available for number types // 2) Give the code unnecessary complexity // 3) Have several limitations like missing most `Array.prototype` methods diff --git a/vlib/v/live/executable/reloader.v b/vlib/v/live/executable/reloader.v index 1b7c8d0f7..7f89e93dc 100644 --- a/vlib/v/live/executable/reloader.v +++ b/vlib/v/live/executable/reloader.v @@ -11,7 +11,7 @@ pub const ( ) // The live reloader code is implemented here. -// NB: new_live_reload_info will be called by generated C code inside main() +// Note: new_live_reload_info will be called by generated C code inside main() pub fn new_live_reload_info(original string, vexe string, vopts string, live_fn_mutex voidptr, live_linkfn live.FNLinkLiveSymbols) &live.LiveReloadInfo { file_base := os.file_name(original).replace('.v', '') so_dir := os.cache_dir() @@ -34,7 +34,7 @@ pub fn new_live_reload_info(original string, vexe string, vopts string, live_fn_ } } -// NB: start_reloader will be called by generated code inside main(), to start +// Note: start_reloader will be called by generated code inside main(), to start // the hot code reloader thread. start_reloader is executed in the context of // the original main thread. pub fn start_reloader(mut r live.LiveReloadInfo) { @@ -127,7 +127,7 @@ fn protected_load_lib(mut r live.LiveReloadInfo, new_lib_path string) { os.rm(new_lib_path) or {} } -// NB: r.reloader() is executed in a new, independent thread +// Note: r.reloader() is executed in a new, independent thread fn reloader(mut r live.LiveReloadInfo) { // elog(r,'reloader, r: $r') mut last_ts := os.file_last_mod_unix(r.original) diff --git a/vlib/v/live/live_test.v b/vlib/v/live/live_test.v index c169ba41e..86d40895d 100644 --- a/vlib/v/live/live_test.v +++ b/vlib/v/live/live_test.v @@ -24,7 +24,7 @@ Since this test program is sensitive to coordination (or lack of) of several pro it tries to sidestep the coordination issue by polling the file system for the existance of files, ORIGINAL.txt ... STOP.txt , which are appended to by the generated program. -NB: That approach of monitoring the state of the running generated program, is clearly not ideal, +Note: That approach of monitoring the state of the running generated program, is clearly not ideal, but sidesteps the issue of coordinating processes through IPC or stdin/stdout in hopefully not very flaky way. @@ -59,7 +59,7 @@ fn edefault(name string, default string) string { } fn atomic_write_source(source string) { - // NB: here wrtiting is done in 2 steps, since os.write_file can take some time, + // Note: here wrtiting is done in 2 steps, since os.write_file can take some time, // during which the file will be modified, but it will still be not completely written. // The os.mv after that, guarantees that the reloader will see a complete valid V program. os.write_file(tmp_file, source) or { panic(err) } diff --git a/vlib/v/parser/containers.v b/vlib/v/parser/containers.v index 4c5939e6d..beb6a40a2 100644 --- a/vlib/v/parser/containers.v +++ b/vlib/v/parser/containers.v @@ -58,7 +58,7 @@ fn (mut p Parser) array_init() ast.ArrayInit { p.inside_array_lit = old_inside_array_lit line_nr := p.tok.line_nr $if tinyc { - // NB: do not remove the next line without testing + // Note: do not remove the next line without testing // v selfcompilation with tcc first tcc_stack_bug := 12345 _ = tcc_stack_bug diff --git a/vlib/v/parser/parser.v b/vlib/v/parser/parser.v index 27fbb59ad..e68b84390 100644 --- a/vlib/v/parser/parser.v +++ b/vlib/v/parser/parser.v @@ -205,7 +205,7 @@ pub fn (mut p Parser) set_path(path string) { } pub fn parse_file(path string, table &ast.Table, comments_mode scanner.CommentsMode, pref &pref.Preferences) &ast.File { - // NB: when comments_mode == .toplevel_comments, + // Note: when comments_mode == .toplevel_comments, // the parser gives feedback to the scanner about toplevel statements, so that the scanner can skip // all the tricky inner comments. This is needed because we do not have a good general solution // for handling them, and should be removed when we do (the general solution is also needed for vfmt) @@ -2898,7 +2898,7 @@ fn (mut p Parser) string_expr() ast.Expr { mut has_fmt := false mut fwidth := 0 mut fwidthneg := false - // 987698 is a magic default value, unlikely to be present in user input. NB: 0 is valid precision + // 987698 is a magic default value, unlikely to be present in user input. Note: 0 is valid precision mut precision := 987698 mut visible_plus := false mut fill := false @@ -3018,7 +3018,7 @@ fn (mut p Parser) module_decl() ast.Module { p.error_with_pos('`module` and `$name` must be at same line', name_pos) return mod_node } - // NB: this shouldn't be reassigned into name_pos + // Note: this shouldn't be reassigned into name_pos // as it creates a wrong position when extended // to module_pos n_pos := p.tok.pos() diff --git a/vlib/v/pref/pref.v b/vlib/v/pref/pref.v index 4e16102fa..8ce75fcb5 100644 --- a/vlib/v/pref/pref.v +++ b/vlib/v/pref/pref.v @@ -118,7 +118,7 @@ pub mut: is_run bool is_debug bool // turned on by -g or -cg, it tells v to pass -g to the C backend compiler. is_vlines bool // turned on by -g (it slows down .tmp.c generation slightly). - // NB: passing -cg instead of -g will set is_vlines to false and is_debug to true, thus making v generate cleaner C files, + // Note: passing -cg instead of -g will set is_vlines to false and is_debug to true, thus making v generate cleaner C files, // which are sometimes easier to debug / inspect manually than the .tmp.c files by plain -g (when/if v line number generation breaks). sanitize bool // use Clang's new "-fsanitize" option sourcemap bool // JS Backend: -sourcemap will create a source map - default false @@ -260,7 +260,7 @@ pub fn parse_args_and_show_errors(known_external_commands []string, args []strin res.check_only = true } '-h', '-help', '--help' { - // NB: help is *very important*, just respond to all variations: + // Note: help is *very important*, just respond to all variations: res.is_help = true } '-v' { @@ -673,7 +673,7 @@ pub fn parse_args_and_show_errors(known_external_commands []string, args []strin res.parse_define('debug') } if command == 'run' && res.is_prod && os.is_atty(1) > 0 { - eprintln_cond(show_output, "NB: building an optimized binary takes much longer. It shouldn't be used with `v run`.") + eprintln_cond(show_output, "Note: building an optimized binary takes much longer. It shouldn't be used with `v run`.") eprintln_cond(show_output, 'Use `v run` without optimization, or build an optimized binary with -prod first, then run it separately.') } @@ -889,7 +889,7 @@ pub fn cc_from_string(cc_str string) CompilerType { } pub fn get_host_arch() Arch { - // NB: we can not use `$if arch` here, because V skips cgen for the non + // Note: we can not use `$if arch` here, because V skips cgen for the non // current comptime branches by default, so there is a bootstrapping // problem => the __V_architecture macro is used to resolve it. // TODO: think about how to solve it for non C backends, perhaps we diff --git a/vlib/v/scanner/scanner.v b/vlib/v/scanner/scanner.v index 9b117613d..e5bcb8f3d 100644 --- a/vlib/v/scanner/scanner.v +++ b/vlib/v/scanner/scanner.v @@ -152,7 +152,7 @@ fn (mut s Scanner) init_scanner() { [unsafe] pub fn (mut s Scanner) free() { unsafe { - // NB: s.text is not freed here, because it is shared with all other util.read_file instances, + // Note: s.text is not freed here, because it is shared with all other util.read_file instances, // and strings are not reference counted yet: // s.text.free() // .all_tokens however are not shared with anything, and can be freed: @@ -166,7 +166,7 @@ fn (s &Scanner) should_parse_comment() bool { || (s.comments_mode == .toplevel_comments && !s.is_inside_toplvl_statement) } -// NB: this is called by v's parser +// Note: this is called by v's parser pub fn (mut s Scanner) set_is_inside_toplevel_statement(newstate bool) { s.is_inside_toplvl_statement = newstate } @@ -1059,7 +1059,7 @@ fn (mut s Scanner) text_scan() token.Token { } } if is_separate_line_comment { - // NB: ´\x01´ is used to preserve the initial whitespace in comments + // Note: ´\x01´ is used to preserve the initial whitespace in comments // that are on a separate line comment = '\x01' + comment } diff --git a/vlib/v/tests/anon_fn_returning_question_test.v b/vlib/v/tests/anon_fn_returning_question_test.v index b92e03665..86b80bc5d 100644 --- a/vlib/v/tests/anon_fn_returning_question_test.v +++ b/vlib/v/tests/anon_fn_returning_question_test.v @@ -7,7 +7,7 @@ fn test_calling_an_anon_function_returning_question() { fn create_and_call_anon_function() ? { x := fn (a string, b int) ? { println('test') - // NB: the anon function does NOT return explicitly, + // Note: the anon function does NOT return explicitly, // so V should generate an implicit "OK" value and // return it. Previously, it created an implicit optional // filled with 0s => .ok was false, and that was treated diff --git a/vlib/v/tests/bench/math_big_gcd/bench_euclid.v b/vlib/v/tests/bench/math_big_gcd/bench_euclid.v index 68b089d23..9be61138b 100644 --- a/vlib/v/tests/bench/math_big_gcd/bench_euclid.v +++ b/vlib/v/tests/bench/math_big_gcd/bench_euclid.v @@ -1,6 +1,6 @@ module main -// NB: this benchmark is preferable to be compiled with: `v -prod -cg -gc boehm bench_euclid.v` +// Note: this benchmark is preferable to be compiled with: `v -prod -cg -gc boehm bench_euclid.v` import math.big import benchmark import os diff --git a/vlib/v/tests/calling_module_functions_with_maps_of_arrays_test.v b/vlib/v/tests/calling_module_functions_with_maps_of_arrays_test.v index 32f401f06..9b0afdaeb 100644 --- a/vlib/v/tests/calling_module_functions_with_maps_of_arrays_test.v +++ b/vlib/v/tests/calling_module_functions_with_maps_of_arrays_test.v @@ -2,7 +2,7 @@ import json fn test_calling_functions_with_map_initializations_containing_arrays() { result := json.encode({ - // NB: []string{} should NOT be treated as []json.string{} + // Note: []string{} should NOT be treated as []json.string{} 'users': []string{} 'groups': []string{} }) diff --git a/vlib/v/tests/closure_generator_test.v b/vlib/v/tests/closure_generator_test.v index 45676a722..70d31b971 100644 --- a/vlib/v/tests/closure_generator_test.v +++ b/vlib/v/tests/closure_generator_test.v @@ -63,7 +63,7 @@ const return_types = [ // and parameters of type `typ`, to makes sure that all combinations work correctly fn test_closures_with_n_args() ? { mut v_code := strings.new_builder(1024) - // NB: the type or value of the captured arg doesn't matter for this test, + // Note: the type or value of the captured arg doesn't matter for this test, // as the entire closure context is always passed as one pointer anyways v_code.write_string('struct BigStruct {') @@ -96,7 +96,7 @@ fn test_closures_with_n_args() ? { "'127'", 'string' } - // NB: the captured arg doesn't matter for this test, as closures always receive + // Note: the captured arg doesn't matter for this test, as closures always receive // a pointer to the entire closure context as their last argument anyways v_code.writeln(" fn test_big_closure_${typ}_${i}() { @@ -136,7 +136,7 @@ fn test_big_closure_${typ}_${i}() { } else { 'c(${values.join(', ')}) $assertion' } - // NB: the captured arg doesn't matter for this test, as closures always receive + // Note: the captured arg doesn't matter for this test, as closures always receive // a pointer to the entire closure context as their last argument anyways v_code.writeln(" fn test_closure_return_${styp}_${i}() ? { diff --git a/vlib/v/tests/comptime_if_expr_test.v b/vlib/v/tests/comptime_if_expr_test.v index 868d298fa..93e3d380a 100644 --- a/vlib/v/tests/comptime_if_expr_test.v +++ b/vlib/v/tests/comptime_if_expr_test.v @@ -3,7 +3,7 @@ const ( disable_opt_features = true ) -// NB: the `unknown_fn()` calls are here on purpose, to make sure that anything +// Note: the `unknown_fn()` calls are here on purpose, to make sure that anything // that doesn't match a compile-time condition is not even parsed. fn test_ct_expressions() { foo := version diff --git a/vlib/v/tests/const_comptime_eval_before_vinit_test.v b/vlib/v/tests/const_comptime_eval_before_vinit_test.v index 9a9b0f7c2..08bd30c0f 100644 --- a/vlib/v/tests/const_comptime_eval_before_vinit_test.v +++ b/vlib/v/tests/const_comptime_eval_before_vinit_test.v @@ -1,4 +1,4 @@ -// NB: the names are deliberately prefixed with zzz_, so that searching +// Note: the names are deliberately prefixed with zzz_, so that searching // for that in the generated C code is easier. Do not rename the consts. const zzz_an_i8_const = i8(0x28) diff --git a/vlib/v/tests/generic_fn_infer_test.v b/vlib/v/tests/generic_fn_infer_test.v index 6ae8ae5ae..dd040cc8c 100644 --- a/vlib/v/tests/generic_fn_infer_test.v +++ b/vlib/v/tests/generic_fn_infer_test.v @@ -30,7 +30,7 @@ fn test_literal() { // fn choose4(a T, b T, c T, d T) T { - // NB: a similar construct is used in prime31's via engine + // Note: a similar construct is used in prime31's via engine return a } diff --git a/vlib/v/tests/generics_method_ordering_test.v b/vlib/v/tests/generics_method_ordering_test.v index c3c1d678c..ab3fe364c 100644 --- a/vlib/v/tests/generics_method_ordering_test.v +++ b/vlib/v/tests/generics_method_ordering_test.v @@ -10,7 +10,7 @@ struct Bar { y int } -// NB: Bar.foo before Bar.pop, should not cause a V compiler panic +// Note: Bar.foo before Bar.pop, should not cause a V compiler panic fn (b Bar) foo() bool { return true } diff --git a/vlib/v/tests/if_smartcast_test.v b/vlib/v/tests/if_smartcast_test.v index 5a46729c7..fbeea3b04 100644 --- a/vlib/v/tests/if_smartcast_test.v +++ b/vlib/v/tests/if_smartcast_test.v @@ -102,7 +102,7 @@ fn test_mutable_with_struct() { assert c.abc.val == 'xyz' } if mut c.abc is Abc { - // NB: in this second smart cast, `another` is + // Note: in this second smart cast, `another` is // the same wrapped value, that was changed in // the first smart cast: assert c.abc.val == 'xyz' diff --git a/vlib/v/tests/interface_edge_cases/array_of_interfaces_with_utility_fn_test.v b/vlib/v/tests/interface_edge_cases/array_of_interfaces_with_utility_fn_test.v index 32c794b7b..18dde7fdb 100644 --- a/vlib/v/tests/interface_edge_cases/array_of_interfaces_with_utility_fn_test.v +++ b/vlib/v/tests/interface_edge_cases/array_of_interfaces_with_utility_fn_test.v @@ -13,7 +13,7 @@ fn get_name(s Speaker) { // fn test_an_array_of_interfaces_works() { dog := Dog{} - get_name(dog) // NB: this line does nothing, but forces interface _name_table generation + get_name(dog) // Note: this line does nothing, but forces interface _name_table generation get_names([dog, dog]) } diff --git a/vlib/v/tests/map_sumtype_values_test.v b/vlib/v/tests/map_sumtype_values_test.v index 01d27067a..6357a09ca 100644 --- a/vlib/v/tests/map_sumtype_values_test.v +++ b/vlib/v/tests/map_sumtype_values_test.v @@ -1,4 +1,4 @@ -// NB: this test should be able to run without warnings/errors +// Note: this test should be able to run without warnings/errors type SumType = bool | int | string diff --git a/vlib/v/tests/match_test.v b/vlib/v/tests/match_test.v index 25d96e13a..e17c3598f 100644 --- a/vlib/v/tests/match_test.v +++ b/vlib/v/tests/match_test.v @@ -194,7 +194,7 @@ struct Bravo { // A field so that Alfa and Bravo structures aren't the same dummy_field int pub mut: - // NB: the `char` field is not `pub` or `mut` in all sumtype variants, but using it in aggregates should still work + // Note: the `char` field is not `pub` or `mut` in all sumtype variants, but using it in aggregates should still work char rune = `b` } diff --git a/vlib/v/tests/modules/amodule/another_internal_module_test.v b/vlib/v/tests/modules/amodule/another_internal_module_test.v index ca845cfd6..04831180e 100644 --- a/vlib/v/tests/modules/amodule/another_internal_module_test.v +++ b/vlib/v/tests/modules/amodule/another_internal_module_test.v @@ -2,7 +2,7 @@ module amodule // This tests whether _test.v files can be *internal* to a // module, and thus have access to its guts. -// NB: the function test_private_isub() is defined both here +// Note: the function test_private_isub() is defined both here // and inside internal_module_test.v . That is done on purpose, // with the goal of ensuring that _test.v files are compiled // *independently* from each other. diff --git a/vlib/v/tests/mut_receiver_returned_as_reference_test.v b/vlib/v/tests/mut_receiver_returned_as_reference_test.v index f89e7f975..b6882e94a 100644 --- a/vlib/v/tests/mut_receiver_returned_as_reference_test.v +++ b/vlib/v/tests/mut_receiver_returned_as_reference_test.v @@ -10,7 +10,7 @@ fn (mut p Player) set_name(name string) &Player { return unsafe { p } // because of automatic (de)reference of return values } -// NB: `p` is declared as a `mut` parameter, +// Note: `p` is declared as a `mut` parameter, // which now only affects its mutability. fn (mut p Player) set_position(x int, y int) &Player { p.x = x diff --git a/vlib/v/tests/project_with_c_code_2/modc/wrapper.v b/vlib/v/tests/project_with_c_code_2/modc/wrapper.v index 9ad8dfb3d..537a728c7 100644 --- a/vlib/v/tests/project_with_c_code_2/modc/wrapper.v +++ b/vlib/v/tests/project_with_c_code_2/modc/wrapper.v @@ -7,7 +7,7 @@ module modc struct C.Atype { } -// NB: [trusted] below, means that the C function, can be safely called outside unsafe{} blocks. +// Note: [trusted] below, means that the C function, can be safely called outside unsafe{} blocks. // // By default, all C. functions are NOT trusted, and all V functions are by default trusted. // diff --git a/vlib/v/tests/project_with_c_code_3/mod1/wrapper.js.v b/vlib/v/tests/project_with_c_code_3/mod1/wrapper.js.v index 0670fc192..2897d17af 100644 --- a/vlib/v/tests/project_with_c_code_3/mod1/wrapper.js.v +++ b/vlib/v/tests/project_with_c_code_3/mod1/wrapper.js.v @@ -1,6 +1,6 @@ module mod1 -// NB: the function here, overrides the one from wrapper.v +// Note: the function here, overrides the one from wrapper.v pub fn vadd(a int, b int) int { return 2003 } diff --git a/vlib/v/tests/project_with_c_code_3/mod1/wrapper.v b/vlib/v/tests/project_with_c_code_3/mod1/wrapper.v index c161903c5..a569634bb 100644 --- a/vlib/v/tests/project_with_c_code_3/mod1/wrapper.v +++ b/vlib/v/tests/project_with_c_code_3/mod1/wrapper.v @@ -1,6 +1,6 @@ module mod1 -// NB: the function here, should be overriden by the one in the wrapper.c.v file with the same name +// Note: the function here, should be overriden by the one in the wrapper.c.v file with the same name pub fn vadd(a int, b int) int { return 123456 } diff --git a/vlib/v/tests/project_with_modules_having_submodules/bin/a_program_under_bin_can_find_mod1_test.v b/vlib/v/tests/project_with_modules_having_submodules/bin/a_program_under_bin_can_find_mod1_test.v index b5f99407a..1ef84d3fb 100644 --- a/vlib/v/tests/project_with_modules_having_submodules/bin/a_program_under_bin_can_find_mod1_test.v +++ b/vlib/v/tests/project_with_modules_having_submodules/bin/a_program_under_bin_can_find_mod1_test.v @@ -10,7 +10,7 @@ fn test_pub_const_using_private_fn_for_its_initialisation() { } /* -NB: this main program is under bin/ , but it still +Note: this main program is under bin/ , but it still can find mod1, because the parent project has v.mod, so v module lookup for this program will find mod1 through relation to the parent v.mod file diff --git a/vlib/v/tests/retry_test.v b/vlib/v/tests/retry_test.v index 8cfdde20e..80a735c07 100644 --- a/vlib/v/tests/retry_test.v +++ b/vlib/v/tests/retry_test.v @@ -9,7 +9,7 @@ import os // This is useful for reducing false positives on the CI, due to // flakyness of specific tests like `vlib/v/live/live_test.v` for example. -// NB: this test is supposed to be run with `v test retry_test.v`. +// Note: this test is supposed to be run with `v test retry_test.v`. // Running just `v retry_test.v` WILL fail. fn test_test_runner_retrying_failing_tests() { diff --git a/vlib/v/tests/string_interpolation_array_test.v b/vlib/v/tests/string_interpolation_array_test.v index b71b4ad4e..dc9779643 100644 --- a/vlib/v/tests/string_interpolation_array_test.v +++ b/vlib/v/tests/string_interpolation_array_test.v @@ -2,7 +2,7 @@ // a) an array of custom structs, // b) also for the custom struct itself (when the .str() for it is missing). // -// NB: this is very simillar to string_interpolation_struct_test.v +// Note: this is very simillar to string_interpolation_struct_test.v // but they should NOT be merged into 1 file. If you merge it with // string_interpolation_struct_test.v, which tests whether the compiler // can generate the default method for a struct, then the b) case of diff --git a/vlib/v/tests/sumtype_str_for_subtypes_with_str_test.v b/vlib/v/tests/sumtype_str_for_subtypes_with_str_test.v index a9b34f03b..d9666576b 100644 --- a/vlib/v/tests/sumtype_str_for_subtypes_with_str_test.v +++ b/vlib/v/tests/sumtype_str_for_subtypes_with_str_test.v @@ -1,7 +1,7 @@ // Test whether a sumtype that has multiple subtypes, // some with custom .str() methods, can be converted to a string, // i.e. whether its own autogenerated .str() method will work. -// NB: Dictionary.str() calls $v.str() in the string interpolation, +// Note: Dictionary.str() calls $v.str() in the string interpolation, // which in turn can call Dictionary.str(), i.e. they are mutually // recursive. type Object = Dictionary | Stream | bool | f32 | int | string diff --git a/vlib/v/tests/type_idx_test.v b/vlib/v/tests/type_idx_test.v index aa8fb0bb4..aac55fec7 100644 --- a/vlib/v/tests/type_idx_test.v +++ b/vlib/v/tests/type_idx_test.v @@ -1,4 +1,4 @@ -// NB: .type_name() and .type_idx() called on an interface instance are more expensive +// Note: .type_name() and .type_idx() called on an interface instance are more expensive // than typeof(instance).name and typeof(instance).idx, since they will search and return // the name and type index of the concrete interface instance. // diff --git a/vlib/v/tests/valgrind/fn_with_return_should_free_local_vars.v b/vlib/v/tests/valgrind/fn_with_return_should_free_local_vars.v index 35ca7a944..94bf51ff8 100644 --- a/vlib/v/tests/valgrind/fn_with_return_should_free_local_vars.v +++ b/vlib/v/tests/valgrind/fn_with_return_should_free_local_vars.v @@ -9,7 +9,7 @@ fn many_strings() []string { fn abc() int { x := many_strings() n := x.len - // NB: the local `x` is no longer used + // Note: the local `x` is no longer used // it should be freed *before* the return return n } diff --git a/vlib/v/tests/valgrind/valgrind_test.v b/vlib/v/tests/valgrind/valgrind_test.v index 51b6ab7b4..75f894dda 100644 --- a/vlib/v/tests/valgrind/valgrind_test.v +++ b/vlib/v/tests/valgrind/valgrind_test.v @@ -10,7 +10,7 @@ fn bold(s string) string { } // -// NB: skip_compile_files can be used for totally skipping .v files temporarily. +// Note: skip_compile_files can be used for totally skipping .v files temporarily. // .v files in skip_valgrind_files will be compiled, but will not be run under // valgrind. This ensures that at least the generated code does not have C syntax // errors. diff --git a/vlib/v/token/token.v b/vlib/v/token/token.v index 3c73552ea..4e545e133 100644 --- a/vlib/v/token/token.v +++ b/vlib/v/token/token.v @@ -152,8 +152,8 @@ const nr_tokens = int(Kind._end_) // @VEXE => will be substituted with the path to the V compiler // @VEXEROOT => will be substituted with the *folder* where the V executable is (as a string). // @VROOT => the old name for @VMODROOT; sometimes it was used as @VEXEROOT; -// NB: @VROOT is now deprecated, use either @VMODROOT or @VEXEROOT instead. -// NB: @VEXEROOT & @VMODROOT are used for compilation options like this: +// Note: @VROOT is now deprecated, use either @VMODROOT or @VEXEROOT instead. +// Note: @VEXEROOT & @VMODROOT are used for compilation options like this: // #include "@VMODROOT/include/abc.h" // #flag -L@VEXEROOT/thirdparty/libgc // diff --git a/vlib/v/util/errors.v b/vlib/v/util/errors.v index c4f50dcae..2f25e3de4 100644 --- a/vlib/v/util/errors.v +++ b/vlib/v/util/errors.v @@ -13,7 +13,7 @@ import v.mathutil as mu // The filepath:line:col: format is the default C compiler error output format. // It allows editors and IDE's like emacs to quickly find the errors in the // output and jump to their source with a keyboard shortcut. -// NB: using only the filename may lead to inability of IDE/editors +// Note: using only the filename may lead to inability of IDE/editors // to find the source file, when the IDE has a different working folder than // v itself. // error_context_before - how many lines of source context to print before the pointer line diff --git a/vlib/v/util/surrounder.v b/vlib/v/util/surrounder.v index 47ae2a14e..0cced0748 100644 --- a/vlib/v/util/surrounder.v +++ b/vlib/v/util/surrounder.v @@ -7,7 +7,7 @@ import strings // code, in a synchronised way. It does so by forcing you to put the // creation/destruction samples next to each other, so that it is easier to // keep them in sync and spot errors. -// NB: Surrounder writes the creation samples (`befores`) in the _same_ order +// Note: Surrounder writes the creation samples (`befores`) in the _same_ order // they were added, and the destruction samples (`afters`) in _reverse_ order. // // Usage: diff --git a/vlib/v/util/util.v b/vlib/v/util/util.v index b6a74c8c6..6ddbf948e 100644 --- a/vlib/v/util/util.v +++ b/vlib/v/util/util.v @@ -44,7 +44,7 @@ pub fn tabs(n int) string { pub fn set_vroot_folder(vroot_path string) { // Preparation for the compiler module: // VEXE env variable is needed so that compiler.vexe_path() can return it - // later to whoever needs it. NB: guessing is a heuristic, so only try to + // later to whoever needs it. Note: guessing is a heuristic, so only try to // guess the V executable name, if VEXE has not been set already. vexe := os.getenv('VEXE') if vexe == '' { @@ -185,7 +185,7 @@ pub fn launch_tool(is_verbose bool, tool_name string, args []string) { exit(2) } -// NB: should_recompile_tool/4 compares unix timestamps that have 1 second resolution +// Note: should_recompile_tool/4 compares unix timestamps that have 1 second resolution // That means that a tool can get recompiled twice, if called in short succession. // TODO: use a nanosecond mtime timestamp, if available. pub fn should_recompile_tool(vexe string, tool_source string, tool_name string, tool_exe string) bool { diff --git a/vlib/v/util/version/version.v b/vlib/v/util/version/version.v index 7e38733a0..908fcd6df 100644 --- a/vlib/v/util/version/version.v +++ b/vlib/v/util/version/version.v @@ -39,7 +39,7 @@ pub fn full_v_version(is_verbose bool) string { // relevant files in the .git/ folder, or if that is not possible // for example when using a V from a V binary release, that does not have .git/ // defaults to getting the predefined C constant again. -// NB: githash(true) must be called only when v detects that it builds itself. +// Note: githash(true) must be called only when v detects that it builds itself. // For all other programs, githash(false) should be used. pub fn githash(should_get_from_filesystem bool) string { for { diff --git a/vlib/v/vcache/vcache.v b/vlib/v/vcache/vcache.v index 15fe3d716..340155082 100644 --- a/vlib/v/vcache/vcache.v +++ b/vlib/v/vcache/vcache.v @@ -8,7 +8,7 @@ import hash // Most filesystems can not handle performantly such folders, and slow down. // The first level will contain a max of 256 folders, named from 00/ to ff/. // Each of them will contain many entries, but hopefully < 1000. -// NB: using a hash here, makes the cache storage immune to special +// Note: using a hash here, makes the cache storage immune to special // characters in the keys, like quotes, spaces and so on. // Cleanup of the cache is simple: just delete the $VCACHE folder. // The cache tree will look like this: @@ -63,7 +63,7 @@ pub fn new_cache_manager(opts []string) CacheManager { } // set_temporary_options can be used to add temporary options to the hash salt -// NB: these can be changed easily with another .set_temporary_options call +// Note: these can be changed easily with another .set_temporary_options call // without affecting the .original_vopts pub fn (mut cm CacheManager) set_temporary_options(new_opts []string) { cm.vopts = cm.original_vopts + '#' + new_opts.join('|') -- 2.30.2