Brain-Score 91/100 TECH C++ Weekly With Jason Turner · 6:33

C++ Weekly - Ep 339 - `static constexpr` vs `inline constexpr`

3-Second Blueprint (English)

  1. Inside a function, plain constexpr copies large local objects onto the stack on every call; static constexpr eliminates that copy.
  2. At header file scope, static constexpr gives internal linkage that duplicates a 40 MB blob across two files into an 80 MB binary.
  3. Marking header-scope constants inline constexpr—without static—lets the linker deduplicate compile-time data across translation units.
static constexpr (Function Scope)inline constexpr (Header Scope)Internal Linkage DuplicationLinker Data Deduplication

3-Sekunden-Fazit (Deutsch)

  1. In Funktionen kopiert bloßes constexpr große Objekte bei jedem Aufruf auf den Stack; static constexpr verhindert dieses Kopieren.
  2. Im Header führt static constexpr durch interne Bindung dazu, dass ein 40-MB-Block in zwei Dateien zu einer 80-MB-Binärdatei wird.
  3. Nur inline constexpr (ohne static) auf Dateiebene erlaubt dem Linker, identische Compilezeit-Daten über Übersetzungseinheiten zu teilen.
static constexpr (Funktionslokal)inline constexpr (Header-Ebene)Interne Bindung & DuplizierungLinker-Datendeduplizierung

Note / Hinweis: Blueprints are AI-generated educational summaries (0% Politics · 0% Religion · 0% Brainrot) and do not constitute medical, legal, or financial advice. / KI-generierte Zusammenfassung zu Bildungszwecken – ersetzt keine medizinische, rechtliche oder finanzielle Fachberatung.