mmp / pbrt-v3

Source code for pbrt, the renderer described in the third edition of "Physically Based Rendering: From Theory To Implementation", by Matt Pharr, Wenzel Jakob, and Greg Humphreys.
http://pbrt.org
BSD 2-Clause "Simplified" License
4.86k stars 1.18k forks source link

Possible minor bug in stringprint.h #245

Closed laoreja closed 4 years ago

laoreja commented 5 years ago

at L61, I need to switch CHECK_EQ(c[1], '%'); to CHECK_EQ(c[0], '%'); to make std::cout work for Matrix4x4. Not sure why there is such a line, given it is already the condition for if.

mmp commented 4 years ago

Hm, I'm not able to reproduce this--do you have a repro case?

That check is, I believe, correct as written: the intent is to check that, once all of the arguments have been processed, there aren't any formatting directives left in the string. It is, however, allowed to have "%%", which turns into a single "%" in the output, and that's what that check is testing for.