Timeline for Monitoring errors with singleton
Current License: CC BY-SA 3.0
12 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Jan 7, 2017 at 13:22 | comment | added | Cody Gray | Judging by the volume of Turbo C questions I see appear on Stack Overflow, I'm not sure if that's true. :-) Aside from that, many compiler vendors were very slow to introduce support for C++11 features, and lots of shops cannot (or won't) for whatever reason upgrade their toolchains frequently, which means they're stuck with something that supports an indeterminate blend of C++03 and C++11. Thread-safe initialization of statics might not be among the supported features. | |
| Jan 7, 2017 at 13:20 | comment | added | Incomputable | @CodyGray, done. Though I think C++03 is becoming rare with every day. | |
| Jan 7, 2017 at 13:20 | history | edited | Incomputable | CC BY-SA 3.0 | added 96 characters in body |
| Jan 7, 2017 at 13:18 | comment | added | Cody Gray | As far as I understand it, though, this alternative isn't thread-safe prior to C++11 (aside from a GCC extension that makes it so). Might be worth pointing that out explicitly in your answer. | |
| Jan 7, 2017 at 13:18 | history | edited | Incomputable | CC BY-SA 3.0 | deleted 1 character in body |
| Jan 7, 2017 at 13:12 | comment | added | Incomputable | @Tim, I pointed that the singleton you implemented is wrong. If you will follow the guide on how to fix it, it will be the same as debugStream(). | |
| Jan 7, 2017 at 13:11 | comment | added | Incomputable | @BitTickler, sorry I thought you're the asker. | |
| Jan 7, 2017 at 13:09 | comment | added | Tim | Actually bullets 3 & 4 are expected behavior: I want to record only if any error occurred and need to print them. I am looking how to improve the code as in my example while retaining it's behavior (record if any error occurred in if statement and print it in the end of main function). | |
| Jan 7, 2017 at 12:24 | comment | added | Incomputable | @BitTickler, well, that's the only choice if you want a singleton. Also, you will get thread safe initialization for free since C++11. | |
| Jan 7, 2017 at 12:23 | history | edited | Incomputable | CC BY-SA 3.0 | added 173 characters in body |
| Jan 7, 2017 at 12:23 | comment | added | BitTickler | Much better. Only some coding guidelines (e.g. MISRA) disallow static member variables in functions. (testability and a few other reasons). | |
| Jan 7, 2017 at 12:22 | history | answered | Incomputable | CC BY-SA 3.0 |