3 ms·
Portable stack traces in C++
- tom_mellior 9y agoI never knew that there was a __COUNTER__ macro, that's neat, thanks! It's not standardized but seems fairly portable since both GNU and Microsoft support it. On the other hand, __FILE__ and __LINE__ have always been in the C standard. Anyway, this is a neat project, but you don't say much about practical use. Do I really have to manually add TRACE() to the start of every function if I want it to show up in a stack trace, or is there a better way?
- andreasgonewild 9y agoYou're welcome, I have yet to run into a compiler that doesn't support COUNTER. Correct, you would have to add trace statements at strategic points to get more detailed traces; but the granularity is up to you and once you have basic tracing in, it's usable for more than stack-tracing. In my opinion, basic tracing should be built into any substantial piece of code.