stclib / STC

A modern, user friendly, generic, type-safe and fast C99 container library: String, Vector, Sorted and Unordered Map and Set, Deque, Forward List, Smart Pointers, Bitset and Random numbers.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

build fail

ktprime opened this issue · comments

commented

./build_all.sh

gcc 7.5

../include/stc/cstr.h: In function ‘cstr cstr_init()’:
../include/stc/cstr.h:77:60: sorry, unimplemented: non-trivial designated initializers not supported
#define cstr_null (c_make(cstr){.sml = {.last = cstr_s_cap}})
^
../include/stc/cstr.h:103:14: note: in expansion of macro ‘cstr_null’
{ return cstr_null; }
^~~~~~~~~
../include/stc/cstr.h: In function ‘cstr cstr_move(cstr*)’:
../include/stc/cstr.h:77:60: sorry, unimplemented: non-trivial designated initializers not supported
#define cstr_null (c_make(cstr){.sml = {.last = cstr_s_cap}})

clang12

misc/string_bench_STD.cpp:360:44: error: no matching member function for call to 'find'
const auto& it = unordmapTrans.find(vec_shortstrview[j]);
~~~~~~~~~~~~~~^~~~
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/unordered_map.h:923:7: note: candidate function not viable: no known conversion from 'const __gnu_cxx::__alloc_traits<std::allocator<std::basic_string_view>, std::basic_string_view>::value_type' (aka 'const std::basic_string_view') to 'const std::unordered_map<std::basic_string, unsigned long, string_hash, MyEqual>::key_type' (aka 'const std::basic_string') for 1st argument
find(const key_type& __x) const
^

Thanks for reporting.

gcc 7.5: I don't support old compilers, only the C99 standard, and this is conformant C99. That said, the library does not use features of C99 that has been made optional in C11, like VLA.

clang12: this example requires/showcases an std::unordered_map feature from C++20, but I forgot to specify -std=c++20 in the build_all.sh. This has been fixed.

commented

hyb@PC210500096:/mnt/f/emhash/STC/benchmarks$ ./build_all.sh
g++ -std=c++20 -I../include misc/cbits_benchmark.cpp
g++ -std=c++20 -I../include misc/prng_bench.cpp
g++ -std=c++20 -I../include misc/rust_cmap.c
clang: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated]
g++ -std=c++20 -I../include misc/sso_bench.cpp
g++ -std=c++20 -I../include misc/string_bench_STC.cpp
g++ -std=c++20 -I../include misc/string_bench_STD.cpp
misc/string_bench_STD.cpp:360:44: error: no matching member function for call to 'find'
const auto& it = unordmapTrans.find(vec_shortstrview[j]);
~~~~~~~~~~~~~~^~~~
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/unordered_map.h:923:7: note: candidate function not viable: no known conversion from 'const __gnu_cxx::__alloc_traits<std::allocator<std::basic_string_view>, std::basic_string_view>::value_type' (aka 'const std::basic_string_view') to 'const std::unordered_map<std::basic_string, unsigned long, string_hash, MyEqual>::key_type' (aka 'const std::basic_string') for 1st argument
find(const key_type& __x) const
^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/unordered_map.h:919:7: note: candidate function not viable: 'this' argument has type 'const std::unordered_map<std::string, size_t, string_hash, MyEqual>' (aka 'const unordered_map<basic_string, unsigned long, string_hash, MyEqual>'), but method is not marked const
find(const key_type& __x)
^
1 error generated.
g++ -std=c++20 -I../include picobench/picobench_cmap.cpp
picobench/picobench_cmap.cpp:9:10: fatal error: '../external/ankerl/unordered_dense.h' file not found
#include "../external/ankerl/unordered_dense.h"
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Thanks again! I have fixed the benchmark warnings and added -Wall -pedantic. The error you have in misc/string_bench_STD.cpp is because clang12 does not fully support C++20. You need clang13 or 14.

commented

can you merge my pull request

It's done. Your map is now the fastest of the lot overall, as far as I can see.

commented

it depends on use case. I have some different implementions in my git.
you can tyr add emhash5(find hit) and emhash8(dense hash map)