Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upPage 97, thread_local object #44
Comments
This comment has been minimized.
This comment has been minimized.
Hi @jpc0016! Sorry you're having trouble with this. Is it possible that you haven't included the body of the Have a look at https://github.com/JLospinoso/ccc/blob/master/chapter_4/listing_4_6.cpp. It should compile (example: https://wandbox.org/permlink/0MAvZho8A9F46In6) |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Hi @jpc0016, I think you've uncovered a deeper issue! The standard actually says that the
I'll put together an Errata for this -- thanks for reporting and I hope you enjoy the rest of the book! |
I cannot replicate results in Listing 4-7 with code in Listing 4-6. "Tracer" (line 17) is not recognized as an object when using "thread_local" keyword; however, "Tracer" is recognized when I use "static" keyword and I get the output in Listing 4-7. I added the "thread" header file,
#include <thread>
, and it still did not work. Both clang++ and g++ are up to date which should support threading. Help is appreciated.