GCC Newspaper
JULY 29, 2026
rfc Proposed Sentiment 7 / 10

RFC: C preprocessor extension: Multiline/block macro definition

Proposal for a new C preprocessor directive to define multiline macros without backslashes.

A proposal outlines a new GNU C preprocessor directive, #startdef/#enddef, to enable multiline macro definitions without requiring trailing backslashes. This ergonomic feature aims to simplify the writing of large, multi-line macros. The author has a prototype and seeks community feedback before developing a full implementation for libcpp, acknowledging the contribution guidelines for GCC frontends.

In the Thread 2 participants
  1. Joseph Myers <josmyers@redhat.com> reviewer

    Suggests the author consult an existing proposal for similar functionality (#def/#enddef, N3531).

    “You should be talking to Alejandro about his #def/#enddef proposal (N3531).”
  2. NomagnoIsNotDead <alvarosaez316@gmail.com> proposer

    Introduces an RFC for a new preprocessor directive to simplify multiline macro definitions.

    “I have an idea to extend the GNU C preprocessor with a new kind of directive. Its behaviour should be sufficiently encapsulated by the following simple example: #startdef MACRO_NAME You may define multiline macros here. No backslashes are needed. #enddef”

Technical Tradeoffs

  • Adds a new directive, potentially increasing preprocessor complexity.
  • Improves ergonomics for writing multiline macros, avoiding backslash escapes.
  • Requires careful integration into existing preprocessor parsing logic.

In Details

This RFC proposes an extension to the GNU C preprocessor (libcpp) to simplify the definition of multiline macros. Instead of using backslashes to escape newlines, this proposal introduces #startdef and #enddef directives to delimit macro definitions that can span multiple lines naturally. The goal is to improve readability and maintainability of complex macros.

For Context
libcpp
The C preprocessor library used by GCC. It handles preprocessor directives, macro expansion, and source file inclusion.
RFC
Request For Comments. A type of document that proposes a change or idea and solicits feedback from the community before implementation.
macro definition
A preprocessor directive (#define) that associates a name with a sequence of replacement text, allowing for code reuse and conditional compilation.
Filed Under: preprocessorextensionmacrosergonomicsRFC