From c8acb5c9dded30350f294e70b55c33ad177c2049 Mon Sep 17 00:00:00 2001 From: Tyge Løvset Date: Sun, 12 Dec 2021 22:20:43 +0100 Subject: Try fix ptr_elems.c. Some more docs for cbox. Temporarily comment out benchmark Action --- CMakeLists.txt | 10 +++++----- docs/cbox_api.md | 14 +++++++++----- examples/ptr_elems.c | 2 +- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6389259c..928ddd87 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,10 +12,10 @@ if(BUILD_TESTING) target_link_libraries(${name} PRIVATE stc m) add_test(NAME ${name} COMMAND ${name}) endforeach() - foreach(name IN ITEMS cdeq clist cmap csmap cvec) - add_executable(${name} benchmarks/plotbench/${name}_benchmark.cpp) - target_link_libraries(${name} PRIVATE stc m) - add_test(NAME ${name} COMMAND ${name}) - endforeach() + # foreach(name IN ITEMS cdeq clist cmap csmap cvec) + # add_executable(${name} benchmarks/plotbench/${name}_benchmark.cpp) + # target_link_libraries(${name} PRIVATE stc m) + # add_test(NAME ${name} COMMAND ${name}) + # endforeach() endif() diff --git a/docs/cbox_api.md b/docs/cbox_api.md index 7c632919..1f10928d 100644 --- a/docs/cbox_api.md +++ b/docs/cbox_api.md @@ -16,13 +16,17 @@ See similar c++ class [std::unique_ptr](https://en.cppreference.com/w/cpp/memory ## Header file and declaration ```c -#define i_val // value: REQUIRED -#define i_cmp // three-way compare two i_val* : REQUIRED IF i_val is a non-integral type -#define i_del // destroy value func - defaults to empty destruct -#define i_tag // defaults to i_val -#include +#define i_val // value: REQUIRED +#define i_cmp // three-way compare two i_val* : REQUIRED IF i_val is a non-integral type +#define i_del // destroy value func - defaults to empty destruct +#define i_from // create from raw/clone func - REQUIRED if i_del is defined, + // unless 'i_opt c_no_clone' is defined. +#define i_tag // type name tag, defaults to i_val +#include ``` `X` should be replaced by the value of `i_tag` in all of the following documentation. +Define `i_opt` with `c_no_compare` if comparison between i_val's is not needed/available. Will then +compare the pointer addresses when used. Additionally, `c_no_clone` or `i_is_fwd` may be defined. ## Methods ```c diff --git a/examples/ptr_elems.c b/examples/ptr_elems.c index 7cb35043..356de6ec 100644 --- a/examples/ptr_elems.c +++ b/examples/ptr_elems.c @@ -56,6 +56,6 @@ int main() cmap_str_emplace(&map, "goodbye", 400); c_forpair (name, number, cmap_str, map) - printf("%s: %d\n", _.name.str, *_.number); + printf("%s: %zd\n", _.name.str, *_.number); } } -- cgit v1.2.3