Repository navigation
Don't print extra spaces in println for empty containers - #232
Open
ItsDeadlyProgrammer wants to merge 1 commit into
Open
ItsDeadlyProgrammer wants to merge 1 commit into
ItsDeadlyProgrammer wants to merge 1 commit into
Conversation
ItsDeadlyProgrammer
force-pushed
the
println-empty-container
branch
from
November 30, 2026 03:45
5e9d61d to
2d718c6
Compare
Author
|
Rebased onto master. The variadic |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #101.
printlnalways puts a space between its arguments, so an empty container leaves extra spaces behind: with an emptya,println(a.size(), a)prints"0 "andprintln(5, a, 7)prints"5 7". Printing n and then the array is very common in generators, so for n = 0 the test file ends up with a trailing space, which a validator doingreadInt()+readEoln()rejects.Now the space is only printed before an argument that actually prints something, so empty containers are just skipped. Strings are printed as before (
println(string(), 5)still gives" 5").Added
tests/test-012_println-empty. The ref comparison ignores whitespace, so the test capturescoutand checks the exact output withensure. It fails without the change and passes with it. Built with g++ for C++11, 14 and 17, and all generators, checkers, validators and interactors in the repo still compile.