Re: Compiler assistance with making a C++ codebase exception safe

Project / Subsystem

gcc / gcc

Date

2026-07-27

Proposer

Julian Waters <tanksherman27@gmail.com>

Source type

public_inbox

Consensus

Proposed

Sentiment

/10

Technical tradeoffs

  • Enabling C++ exceptions can significantly increase code size and complexity due to the runtime support required for exception handling.
  • Compiler optimizations like LTO may not always eliminate all exception handling code, leading to potential bloat and performance overhead.

All attributes

project
gcc
subsystem
gcc
patch_id
discussion_id
CAP2b4GOFrRX_U17HC1WZRrK0tguEER+EhCU-83T+OXQXmdaLaw@mail.gmail.com
source_type
public_inbox
title
Re: Compiler assistance with making a C++ codebase exception safe
headline
Compiler assistance for C++ exception safety
tldr
Discusses GCC options for exception handling, clarifying their scope and limitations for porting codebases.
proposer
Julian Waters <tanksherman27@gmail.com>
consensus
Proposed
outcome
proposed
sentiment_score
technical_tradeoffs
  • Enabling C++ exceptions can significantly increase code size and complexity due to the runtime support required for exception handling.
  • Compiler optimizations like LTO may not always eliminate all exception handling code, leading to potential bloat and performance overhead.
series_id
series_role
reply
series_parts
[]
tags
  • c++
  • exceptions
  • compiler options
  • lto
bugzilla_url
date
2026-07-27T00:00:00.000Z

Re: Compiler assistance with making a C++ codebase exception safe

This discussion addresses challenges in enabling C++ exceptions on codebases previously compiled with -fno-exceptions. Participants clarify that options like throw() to noexcept conversion and pragmas targeting exception specifications primarily affect exception contracts, not the implicit insertion of exception handling code. The core problem remains understanding where and why exceptions are introduced, especially with optimizations like LTO, which may not eliminate all implied exception handlers.