Description
The %% escape (a literal percent sign) is only collapsed to a single % when there is still an unconsumed format argument. When the format string has no remaining arguments — e.g. yapping("100%%"), or any %% that appears after all arguments have been consumed — both percent characters are emitted literally, so the output contains %% instead of %. This affects yapping, yappin, baka, and yapto (they share the formatter / the same code shape).
Minimal reproduction code
skibidi main {
yapping("100%%");
yapping("with arg %d and %%", 5);
bussin 0;
}
Expected behavior
(As in C printf, %% always prints a single %.)
Actual behavior
$ ./brainrot pct.brainrot
100%%
with arg 5 and %%
Note the second line: after %d consumes the only argument, the trailing %% is also emitted literally.
Brainrot version / commit
19b9563
Operating system
Ubuntu on WSL2 (Linux 5.15)
Additional context
Root cause: stdrot/yapping.c (stdrot_format_to_stream) and identically stdrot/baka.c. The %% handling lives inside the branch guarded by if (*format == '%' && arg_idx < arg_count):
if (*format == '%' && arg_idx < arg_count)
{
...
if (*format == '%') { buffer[buffer_offset++] = '%'; format++; continue; }
...
}
else
{
buffer[buffer_offset++] = *format++; // copies each '%' literally
}
When arg_idx >= arg_count, a % (including the first % of a %%) falls to the else branch and is copied verbatim, so %% survives as two characters. The %% escape should be recognized regardless of whether arguments remain — it consumes no argument.
Description
The
%%escape (a literal percent sign) is only collapsed to a single%when there is still an unconsumed format argument. When the format string has no remaining arguments — e.g.yapping("100%%"), or any%%that appears after all arguments have been consumed — both percent characters are emitted literally, so the output contains%%instead of%. This affectsyapping,yappin,baka, andyapto(they share the formatter / the same code shape).Minimal reproduction code
Expected behavior
(As in C
printf,%%always prints a single%.)Actual behavior
Note the second line: after
%dconsumes the only argument, the trailing%%is also emitted literally.Brainrot version / commit
19b9563
Operating system
Ubuntu on WSL2 (Linux 5.15)
Additional context
Root cause:
stdrot/yapping.c(stdrot_format_to_stream) and identicallystdrot/baka.c. The%%handling lives inside the branch guarded byif (*format == '%' && arg_idx < arg_count):When
arg_idx >= arg_count, a%(including the first%of a%%) falls to theelsebranch and is copied verbatim, so%%survives as two characters. The%%escape should be recognized regardless of whether arguments remain — it consumes no argument.