Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
SuperV1234
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
5 ms
·
31.
▲
by
SuperV1234
5mo ago
It is kind of weird at first but the reason is that `std::vector` requires heap allocation and transient allocations are not allowed in `constexpr` contexts. The purpose of `std::define_static_array` is to promote the storage of the vector
32.
▲
by
SuperV1234
5mo ago
This cost is not significant nowadays, it's the frontend/parsing time. You can also use `#pragma once` which works everywhere, is nicer, and technically needs less work by the compiler, but compilers have optimized for include gua
33.
▲
by
SuperV1234
5mo ago
It's a fair comparison. The parent comment isn't showing the compiler source code for the built-in reflection mechanisms. You won't have to care about ^^ and [:X:] if you just want to consume reflection-based utils, which was
34.
▲
by
SuperV1234
5mo ago
C++: enum Color { red, green, blue }; auto name = to_enum_string(Color::Red); // "Red"
35.
▲
by
SuperV1234
5mo ago
...so what? It's just a header you have to #include.
36.
▲
by
SuperV1234
5mo ago
In short, it probes enum values in a pre-defined range (e.g. [-256; 256]), and parses the `__PRETTY_FUNCTION__` macro at compile-time to extract the name of the enumerator. Once you have that in place, you can easily detect duplicates, etc.
37.
▲
by
SuperV1234
5mo ago
Logging, debugging, auto-generation of UIs/editors, etc... This is an extremely common operation and for a good reason.
38.
▲
by
SuperV1234
5mo ago
It is "cryptic" and "ugly" to you just because you're not familiar with it. You'd pick the macro-based implementation because you are familiar with it. Seeing this argumentation is so tiresome, because it feels
39.
▲
by
SuperV1234
5mo ago
Java reflection is another beast altogether as it is runtime reflection. C++26 reflection is purely compile-time , which not only means it adds zero runtime cost, but also prevents those kind-of-insane use cases you see in Java and C#.
40.
▲
by
SuperV1234
5mo ago
I think this is a very bad take -- once you write it by hand you have to manually keep it in sync with the actual struct and ensure you made no mistakes. Reflection guarantees 1-1 future-proof mapping with the actual C++ struct, avoids boil
41.
▲
by
SuperV1234
5mo ago
You can achieve that since C++20 (or C++17 if you don't care about the member names). E.g. https://www.linkedin.com/posts/vittorioromeo_cpp-gamedev-ref... (The link above shows ImGui generation, but the same exact
42.
▲
by
SuperV1234
5mo ago
Nothing that makes it straightforward. Testing via `static_assert` is a good strategy, but it's not debugging. I believe there are some ways of printing custom diagnostics during compilation, but I am not aware of any step-by-step debu
43.
▲
by
SuperV1234
5mo ago
We have been able to automatically do this since C++17: https://www.linkedin.com/posts/vittorioromeo_cpp-gamedev-ref...
44.
▲
by
SuperV1234
5mo ago
You can already automatically serialize/deserialize arbitrarily nested structs since C++17 (using Boost.PFR). Since C++20, you can also serialize/deserialize the struct data member names automatically. For many useful use cases, y
45.
▲
by
SuperV1234
5mo ago
That is true, but on the other hand Modules were standardized more than 6 years ago. Promises and claims have been made for longer than that on how Modules would have improved compilation times and made everyone's lives easier. In 2026
46.
▲
by
SuperV1234
5mo ago
I explicitly mentioned that GCC 16.1 was the compiler used in the benchmarking section, do you think I also need to add a disclaimer in the conclusion section as well? Regardless, I don't think things are going to differ much with Clan
47.
▲
by
SuperV1234
5mo ago
Author here. It isn't a clear "win" at all, there are tradeoffs to each approach.
48.
▲
Cost of enum-to-string: C++26 reflection vs. the old ways
(vittorioromeo.com)
3 points
by
SuperV1234
5mo ago
|
0 comments
49.
▲
by
SuperV1234
5mo ago
It's not a good thing. The reasoning is extremely simple and I don't understand how can anyone oppose it: there are some operations that you don't want to forget BY DEFAULT. If I open a file, eventually I want to close it. If
50.
▲
by
SuperV1234
5mo ago
> Only thing that goes for C++ [...] Nah, that's far from the only thing.
51.
▲
by
SuperV1234
5mo ago
This already happens with -- e.g. -- Claude Code spawnining parallel agents and then collating their results.
52.
▲
by
SuperV1234
5mo ago
Zig doesn't even have RAII...
53.
▲
by
SuperV1234
5mo ago
Closely matches my own experiences with current SOTA AI. Extremely useful collaborator, far from being a replacement for human intelligence and creativity.
54.
▲
by
SuperV1234
5mo ago
Not a fan of the nav, but loved the transitions. Applied them to my website (bespoke C++ static generator + template library): https://vittorioromeo.com/
55.
▲
by
SuperV1234
5mo ago
This is the level of quality you can expect from `ruvnet` projects: https://github.com/deletexiumu/wifi-densepose As a very pro-AI person, this is exactly what I would define AI slop. --- The whole thing is a scam: ht
56.
▲
by
SuperV1234
5mo ago
We are not fundamentally different. Chemical reactions are just math.
57.
▲
Stackless coroutines for gamedev in ~200 lines of C++
(vittorioromeo.com)
6 points
by
SuperV1234
5mo ago
|
0 comments
58.
▲
by
SuperV1234
6mo ago
You'd have to review and verify even changes that you've written by hand. You might think that your hand-written code satisfies A+B+C+D+E, but until you've verified it, you cannot prove it. That's not any different fro
59.
▲
by
SuperV1234
6mo ago
Why don't you stop avoiding the actual question? Or perhaps you have nothing of substance to add?
60.
▲
by
SuperV1234
6mo ago
I understand that, I don't agree with the reasoning and I think it's illogical. Why am I not allowed to comment on it?
More ›