Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
kris-jusiak
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
6 ms
·
1.
▲
by
kris-jusiak
2y ago
Hardware branch prediction is very powerful ( https://www.intel.com/content/www/us/en/developer/articles/t... ) but it's also not perfect and costly misdirections may happen ( http:/&#x
2.
▲
Zero/Minimal overhead static/const branching
(github.com)
2 points
by
kris-jusiak
2y ago
|
1 comments
3.
▲
C++20 – Back to the Future Meta-Programming
(twitter.com)
2 points
by
kris-jusiak
2y ago
|
2 comments
4.
▲
by
kris-jusiak
2y ago
# Meta-Programming is one of the C++ super-powers Traditional meta-programming model in C++ is very powerful but not the easiest to grasp. Mainly because it has different syntax than 'normal' C++ with a lot of angle brackets, it&#
5.
▲
Benchmarking Perfect Hashing in C++
(boost-ext.github.io)
5 points
by
kris-jusiak
2y ago
|
1 comments
6.
▲
by
kris-jusiak
2y ago
Compile-time first unit-testing is a super power of modern C++. It catches errors earlier and helps (to a certain degree) avoiding memory leaks and undefined behaviors. However, the main problem facing compile-time tests are bad error messa
7.
▲
C++ compile-time first / macro free unit-testing
(twitter.com)
1 points
by
kris-jusiak
2y ago
|
1 comments
8.
▲
Stateful metaprogramming (compile-time type list)
(twitter.com)
2 points
by
kris-jusiak
3y ago
|
1 comments
9.
▲
by
kris-jusiak
3y ago
https://wg21.link/P2996 allows form of stateful meta-programming without using friend injection. Meta-counter is pretty easy - https://godbolt.org/z/91M56a5dd as we just iterate over complete instantia
10.
▲
[C++20] 60 LOC constexpr get_name for members / no ifdefs / Clang,GCC,msvc
(twitter.com)
2 points
by
kris-jusiak
3y ago
|
1 comments
11.
▲
by
kris-jusiak
3y ago
Resources: - https://reddit.com/r/cpp/comments/1890jr9/reflectcpp_automat... - https://www.reddit.com/r/cpp/comments/18b8iv9/c20_to_tuple_w... Auto-tuning version of
12.
▲
by
kris-jusiak
3y ago
Following on https://reddit.com/r/cpp/comments/1890jr9/reflectcpp_automat... the following is simple implementation of to_tuple with names (compile-time names) which seems to work on gcc,clang,msvc* It u
13.
▲
[C++20] to_tuple with names
(twitter.com)
2 points
by
kris-jusiak
3y ago
|
1 comments
14.
▲
by
kris-jusiak
3y ago
Experimental approach towards releasing C++ (small) libraries with tests being executed upon include/import at compile-time. Traditional way of testing libraries includes continuous integration systems with huge matrix of possible comb
15.
▲
C++20 State machine library which fully tests itself at compile-time upon use
(github.com)
1 points
by
kris-jusiak
3y ago
|
1 comments
16.
▲
Compile-Time 'Fun' with Std.ranges
(twitter.com)
1 points
by
kris-jusiak
3y ago
|
1 comments
17.
▲
by
kris-jusiak
3y ago
C++20 allows to `almost` natively use std.ranges for template meta-programming. Idea explored at - https://github.com/boost-ext/mp .
18.
▲
by
kris-jusiak
3y ago
IMHO the best approach is to avoid the problem by applying TDD. Then there is very little need to debug anything. But otherwise, there is https://github.com/mikael-s-persson/templight for compile-time debugging which i
19.
▲
by
kris-jusiak
3y ago
Thanks! Most likely not yet applicable at Google's scale but smaller project can defo leverage the approach. Personally, I'm writing most of my tests this way and with TDD the red phase is always a compilation fail which is quicke
20.
▲
by
kris-jusiak
3y ago
I guess so, can't think of an example now but I'm pretty sure there are subtle corner cases (as always) and it depends on the testing, coverage and potential limitations of checking things at compile-time, though, IMHO, the techni
21.
▲
by
kris-jusiak
3y ago
Hmm, there are obvisouly trade offs (it depends on the compiler how many tests, how are they written, etc.) but for apples to apples comparision the gtest binary would have to be either compiled with sanitizers (that would be probably slowe
22.
▲
by
kris-jusiak
3y ago
constexpr has to checked for leaks and UB so as long as there is coverage at compile-time (static_assert + constexpr) I would assume there shouldn't be neither leaks nor UB. But the context is limitted where that can be applied and act
23.
▲
static_assert is all you need (no leaks, no UB)
(twitter.com)
98 points
by
kris-jusiak
3y ago
|
71 comments
24.
▲
by
kris-jusiak
3y ago
With C++20 almost anything can be used in constexpr context (vector, unique_ptr, virtual, function, etc.) and as long as it's in the scope it can be tested at compile time which guarantees memory safatey, no UB, etc. Additionally, sinc
25.
▲
C++ Tip of the Week
(github.com)
1 points
by
kris-jusiak
6y ago
|
0 comments