diff options
-rw-r--r-- | content/2024-04-24-fn-wrapper-macro-magic/index.md | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/content/2024-04-24-fn-wrapper-macro-magic/index.md b/content/2024-04-24-fn-wrapper-macro-magic/index.md index fe45614..b966a1a 100644 --- a/content/2024-04-24-fn-wrapper-macro-magic/index.md +++ b/content/2024-04-24-fn-wrapper-macro-magic/index.md @@ -51,7 +51,7 @@ chance to reason about what the code is doing. The draw back is that bodies have to be repeated for each wrapper. ```cpp -{{ include(path="content/2024-04-22-fn-wrapper-macro-magic/wrap-v1.cc") }} +{{ include(path="content/2024-04-24-fn-wrapper-macro-magic/wrap-v1.cc") }} ``` > In the code examples, I use the `MOCK_WRAPPER_IMPL`<sup><a href="#sup-1">1</a></sup> @@ -70,7 +70,7 @@ reason about the code. Additionally, the arguments must be specified twice, when defining a wrapper. ```cpp -{{ include(path="content/2024-04-22-fn-wrapper-macro-magic/wrap-v2.cc") }} +{{ include(path="content/2024-04-24-fn-wrapper-macro-magic/wrap-v2.cc") }} ``` ## Version 3 @@ -84,7 +84,7 @@ The example only supports function with **one** or **two** arguments, but the code can easily be extended. ```cpp -{{ include(path="content/2024-04-22-fn-wrapper-macro-magic/wrap-v3.cc") }} +{{ include(path="content/2024-04-24-fn-wrapper-macro-magic/wrap-v3.cc") }} ``` ## Version 4 @@ -98,8 +98,12 @@ variadic argument list [__VA_ARGS__][va-args] is presented in [__VA_NARG__][va-narg]. ```cpp, hide_lines=41-100 -{{ include(path="content/2024-04-22-fn-wrapper-macro-magic/wrap-v4.cc") }} +{{ include(path="content/2024-04-24-fn-wrapper-macro-magic/wrap-v4.cc") }} ``` +> The implementation to handle empty arguments **CPP_ARGC() == 0** uses a gcc +> extension for the **##** operator. This is also supported by clang, but not +> by msvc. Maybe I will come back in the future to update this, if I have the +> need. ## Appendix: Listify codegen data |