aboutsummaryrefslogtreecommitdiff
path: root/docs/src/guide/filesystem.rst
diff options
context:
space:
mode:
authortjarlama <59913901+tjarlama@users.noreply.github.com>2020-08-12 22:43:02 +0530
committerGitHub <noreply@github.com>2020-08-12 13:13:02 -0400
commit904b1c9b47faa8962d7c28254ec5949feacbe9fe (patch)
tree044db09e80f0c6b314bcccd12f0b19079c6bd927 /docs/src/guide/filesystem.rst
parent3fc580ec4a580c1e57ae09cf6d19f23bdb40e01c (diff)
downloadlibuv-904b1c9b47faa8962d7c28254ec5949feacbe9fe.tar.gz
libuv-904b1c9b47faa8962d7c28254ec5949feacbe9fe.zip
test: avoid double evaluation in ASSERT_BASE macro
Passing expression as an argument to a function-like macro will replace all occurrence of the arguments with expressions during preprocessing. This result in multiple evaluation of the same expression and can slow-down the program or even change program state. Here ASSERT_BASE macro gets an expression involving a and b as first argument and macro definition has a print statement with a and b, which means there is double evaluation of a and b when the expression evaluates to false. To avoid double evaluation temporary variables are created to store results of a and b. Since the expression argument is dropped from ASSERT_BASE, the macro no longer works for string assertions. So a new macro, ASSERT_BASE_STR, is introduced to deal with strings. ASSERT_BASE can still work with pointers. Fixes: https://github.com/libuv/libuv/issues/2916 PR-URL: https://github.com/libuv/libuv/pull/2926 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Jameson Nash <vtjnash@gmail.com>
Diffstat (limited to 'docs/src/guide/filesystem.rst')
0 files changed, 0 insertions, 0 deletions