https://vittorioromeo.com/index/blog/refl_compiletime.html #C++ #StandardLibrary #compiletime #performance #gamechanger #HackerNews #ngated
The hidden compile-time cost of C++26 reflection
https://vittorioromeo.com/index/blog/refl_compiletime.html
#HackerNews #C++26 #C++reflection #compiletime #programming #performance
Как нарезать Android-монолит с помощью compile-time плагинов?
Привет на связи Федотов Михаил и Абдульманов Эдуард, мы технические лидеры Android разработки в Альфа-Банке и занимаемся приложением для физических лиц. В этой статье вспомним наш опыт разбиения большого монолитного android приложения на мини-приложения срезки, занимались мы этим уже довольно давно, но тема все равно актуальная. Переход к таким мини-приложениям позволяет ускорить конфигурацию Gradle и уменьшить время компиляции проекта как локально так и на CI. Думаю это будет полезно тем кто интересуется архитектурой android приложений, KSP, Dagger, а также тем у кого крупное многомодульное приложение и есть проблемы с производительностью работы Gradle в проекте.
https://habr.com/ru/companies/alfa/articles/1002998/
#ksp #dagger2 #архитектура #compiletime #performance #inversion_of_control
Reflect-C: Tạo metadata lúc biên dịch để mô phỏng phản xạ (reflection) trong C – không cần plugin biên dịch. Giảm lặp code khi serializing, validate, clone struct bằng cách tách biệt metadata và logic runtime. Dùng recipe header + bộ sinh metadata → code chung cho JSON, binary, v.v. Không cần phát hiện kiểu lúc chạy. Phù hợp API, serialization, công cụ kiểm tra. #C #Reflection #Metaprogramming #CompileTime #JSON #Serialization #C_Plus_Plus #LậpTrìnhC #PhảnXạ #ThờiBiênDịch #SerialHóa
https://www
🧩 C++ đã "viết" fan‑fiction của riêng mình! Tác giả xây dựng mô hình bigram Markov chạy hoàn toàn trong thời gian biên dịch bằng constexpr và template metaprogramming. RNG được seed từ __TIME__/__DATE__ bằng FNV‑1a và Xorshift32, mỗi lần compile sinh ra một chuỗi ký tự ngẫu nhiên, không thực hiện tính toán nào khi chạy. Thí nghiệm chứng minh khả năng "dịch" inference vào binary. #C++ #Metaprogramming #Lập_trình #Programming #MetaCPP #CompileTime
⚡ Veld Framework v1.0.3: Compile-Time Dependency Injection
Key innovation: ASM bytecode weaving only for @inject on private fields.
Zero runtime reflection. Everything else is pure method calls.
Performance: 5.9M ops/ms | startup: 1μs | memory: 2.1MB
🏗️ All contributors are welcome!
GitHub: https://github.com/yasmramos/Veld
#Java #OpenSource #Microservices #DI #DependencyInjection #CompileTime #Veld
Xr0 verifier, guarantee the safety of C programs at compile time
#HackerNews #Xr0Verifier #CPrograms #CompileTime #Safety #SoftwareDevelopment
@PeterSommerlad
Right, this is a tough challenge.
Every time I thought I've found a good solution, tests with multiple compilers (possible thanks of @compiler_explorer) and different use cases, at least one of the requirements isn't met.
And then there are compiler implementation bugs. As an example: for the majority of msvc updates from the VS2019 timeframe, code execution isn't reliably stopped (or even at all) at compiletime, producting only compiler warnings. Or older gcc is in some cases totally silent, not even producing a single diagnostic.
Compiletime evaluation is one of the new C++ frontiers where QoI becomes a big differentiator.
The rules of constant expressions are not an easy read. But understanding them well is a prerequisite for e.g. becoming proficient in C++26 reflection.
It is stardate 01-01-2026T09:00:00, we are approaching unchartered territory. It is unclear what future will bring, but I'm already distracted:
I feel like I *need* to find a version of the well-known 'assert(boolean-expression)' from the C (and C++) standard library, that is not only compatible to the well-known runtime behaviour, *but also usable in code execution at compiletime*!
My list of requirements:
* the expression must evaluate to (void)* when the macro NDEBUG is defined.
* same when NDEBUG *is* defined, and the boolean expression in the argument to assert evaluates to something that is convertible to bool, with a value of 'true' *in the current evaluation* of said expression.
* when NDEBUG is defined, and said expression evaluates to something equivalent to 'false', further code execution must be stopped with a diagnostic message. The diagnostic must include the position in source code where the assertion fails during code execution. At runtime, the standards mandate how this is supposed to happen, but are silent about compile time.
* the assert() expression *must* be 'noexcept(true)'.
* the implementation must be immune to further advancements in compiler technology and forseeable C++ language changes. (I know, 'forseeable' and 'advancements' are vague at best).
* the implementation must *not produce* compiler warnings, even at the highest warning levels (like e.g. -Wall -Wextra -Wpedantic -Werror in clang and gcc, or /Wall /WX in msvc). In other words: the assertion must be invisible when its argument passes expectations.
* ideally, the implementation compiles in C++17 mode. This may require support from the compiler.
At present, I have an acceptable implementation but I'm not convinced to reliably meet the third and second to last requirements.
The seemingly obvious candidates for compiletime evaluation - 'static_assert()' or 'throw something' - fail to tick all marks.
Are there any ideas that I might put to test? I will then replace my current one with yours in my proposed changes Viktor Zverovitch's Żmij library that enable compile-time conversions of floating-point numbers to strings, and see how it fares.