Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pages 108, 110, and 111: The given console output of SimpleStringOwner on page 111 is wrong relative to the prior code. #77

WraithGlade opened this issue Dec 25, 2019 · 1 comment


Copy link

@WraithGlade WraithGlade commented Dec 25, 2019

Page 111 claims that this code:

int main() { 
    SimpleStringOwner x{ "x" }; 
    printf("x is alive\n"); 

...will print "Constructed: x" (etc) but it actually won't.

It will instead print "Constructed: : x" (etc) due to the contents of the source code on pages 108 and 110.

The original SimpleString code already adds a colon and a space to tags for its tagged print function, but the later code is designed as if this wasn't the case. These two sections of the book are probably from different revisions of the book that were created during its writing.

Here's the original print function from SimpleString:

void print(const char* tag) const { 
    printf("%s: %s", tag, buffer); 

...and here's how it is used later:

string.print("Constructed: ");


Notice the implications of that.

Copy link

@JLospinoso JLospinoso commented Jan 1, 2020

Thanks, @WraithGlade!

kruschk pushed a commit to kruschk/ccc that referenced this issue Apr 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

No branches or pull requests

2 participants