Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Remove iostream dependency

Open
#241 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
38/100
Issue type
Refactor
Clarity
Mostly clear
Activity status
Stale
Tech stack
cpp
Domain
performance

Research direction

Start in parser.hpp, focusing on detail::print_parser() and parser.call(), where the issue identifies std::ostream and std::stringstream usage. Compare the existing error-reporting path with the printf()-based examples and the reported static executable sizes. Done means the iostream dependency is removed or made customizable without losing the requested error reporting behavior.

Written by the indexing model from the issue text.

Description

The current implementation uses std::ostream in detail::print_parser() and std::stringstream in parser.call() for error reporing. For static linked executables this brings in the whole locale mashinary of STL. Something not always desirable. I suggest replacing it or at least make it customizable whether to use iostreams or not.

I have made two examples with such a parser using printf() for error reporting:
lit('{') > int_ > lit(',') > int_ > lit('}')

Boost Spirit X3 results in a 154 KiB executable and Boost Parser in 218 KiB with error reporting removed in parser.hpp and 963 KiB with error reporting included.
Both compiled with GCC 15.1 for MinGW-W64 using -O2 -ffunction-sections -fdata-sections -s -static -Wl,--gc-sections. LTO makes hardly any difference here.

Dominant language
C++
Stars
182
Forks
28
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from boostorg/parser

All issues in boostorg/parser

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.