>_cmd.script

bcpp

Legacy C/C++ source code beautifier (mostly superseded)

Development

By CMD Script Team · 4 min read · Last updated

SYNTAX
bcpp [OPTIONS] < INPUT > OUTPUT

Options

Command options and flags
FlagDescription
-i NSet the indentation width to N spaces
-sForce a consistent brace style across the reformatted output
-cPreserve or reformat inline comments according to the tool's comment-handling rules
-o FILEWrite reformatted output to FILE instead of standard output
-f FILERead formatting configuration/rules from FILE where supported

Distribution compatibility

  • Not installed by default on Ubuntu/Debian
  • Not installed by default on Fedora/Arch (may require building from source or an old archive)
  • Not available on macOS

What it does

bcpp is an old C/C++ source code "beautifier" — a reformatter that takes source code with inconsistent indentation, brace placement, and spacing and rewrites it according to a fixed or configurable style. It dates from an earlier era of Unix development tooling and was one of several beautifiers (alongside indent) used before modern, more flexible formatters existed. It is a legacy/niche tool today: it is not installed by default on current Ubuntu, Debian, Fedora, Arch, or macOS, and the vast majority of C/C++ projects have moved on to clang-format, which is far more configurable, actively maintained, and integrates cleanly with editors, pre-commit hooks, and CI.

Beginner examples

  • bcpp < input.c > output.c — reformat a file, reading from stdin and writing to stdout
  • bcpp -i 4 < input.c > output.c — reformat using 4-space indentation
  • Because it's rarely installed, the realistic "beginner example" today is usually discovering a reference to bcpp in an old Makefile or README and needing to identify a modern replacement.
bcpp -i 4 < legacy.c > legacy.formatted.c

Advanced examples

  • Historical usage piped through a build step to normalize style before committing: bcpp -s < messy.cpp > clean.cpp
  • Migrating a project off bcpp entirely by replacing its invocation with clang-format in the build/format script: replace bcpp -i 4 file.c with clang-format -i --style=file file.c and add a .clang-format config.
  • Batch-reformatting an old codebase with the modern equivalent instead: find . -name "*.c" -o -name "*.h" | xargs clang-format -i
find . -name "*.c" -o -name "*.cpp" | xargs clang-format -i

Common mistakes

  • Trying to apt install bcpp or brew install bcpp and being surprised it's unavailable or unmaintained — it is not part of standard package repositories on any current mainstream distro.
  • Assuming bcpp's formatting rules match modern style guides (Google, LLVM, etc.) — its configuration model predates those conventions and won't produce equivalent output.
  • Continuing to maintain a build dependency on bcpp in a legacy project instead of migrating the formatting step to a maintained tool, creating friction for new contributors who can't install it.
  • Confusing bcpp (a formatter) with a compiler or linter — it only rearranges whitespace/braces and does not check code correctness.

Tips

  • If you encounter bcpp referenced in an old project, treat it as a strong signal to modernize the formatting toolchain rather than trying to source and install the original binary.
  • clang-format -style=file combined with a checked-in .clang-format is the direct, modern replacement for what bcpp was originally used for.
  • If only light reformatting is needed and clang-format feels heavyweight, indent is a still-available, simpler alternative that's closer in spirit to bcpp.

Best practices

  • Do not introduce new dependencies on bcpp in active projects; use clang-format for new C/C++ codebases.
  • If migrating a legacy project off bcpp, commit a .clang-format configuration that approximates the existing style so the diff from reformatting is manageable.
  • Document any historical bcpp usage in project history/changelogs rather than keeping it as a live build dependency.

Try it yourself

A simulated shell with a sample home directory — experiment freely, nothing leaves your browser. Type help to list supported commands.

Real-world use cases

  • Archaeology on old Unix-era C codebases where build scripts still reference bcpp as a formatting step.
  • Deciding how to modernize a legacy build pipeline that predates today's formatter ecosystem.
  • Teaching context: understanding the lineage of C/C++ formatting tools (bcpp → indent → clang-format) when explaining why current tooling looks the way it does.

Common interview questions

  • Is bcpp still used in modern C/C++ development? No — it's a legacy beautifier not packaged on current Linux distributions or macOS; modern projects use clang-format instead.
  • What replaced bcpp? clang-format is the modern, actively maintained replacement, offering configurable style presets and editor/CI integration that bcpp never had; the older indent command is a lighter-weight alternative that's still available.
  • What did tools like bcpp actually do? They reformatted source code — indentation, brace placement, spacing — according to fixed or configurable rules, without changing program behavior; they're formatters, not compilers or linters.

Frequently Asked Questions

Is bcpp still commonly used?

No. bcpp is an old C/C++ source beautifier that predates today's mainstream formatters. It is not packaged by default on any current major Linux distribution or on macOS, and almost all projects that once used it have migrated to clang-format or indent instead.

What should I use instead of bcpp today?

clang-format is the standard choice for modern C/C++ codebases — it's actively maintained, integrates with editors and CI, and supports configurable style presets (LLVM, Google, Chromium, custom). The older indent command is a lighter-weight, still-available alternative for straightforward C formatting.

Why would I ever encounter bcpp today?

Mainly in very old codebases, legacy build scripts, or Unix history/archival contexts where it was referenced as part of a project's original toolchain. If you find a reference to it in an old Makefile, treat it as a signal to modernize the formatting step to clang-format.

Cheat sheet

Download a quick-reference cheat sheet for bcpp.