print __FILE__ and __LINE__ using the # stringizing operator


/ Published in: C++
Save to your folder(s)

Article explains why STRINGIFY and TOSTRING are both needed.

This technique is useful for embedded apps to print debug strings to a debug console. ASSERT or TRACE statements can incorporate these macros. The line numbers are converted to strings at compile-time rather than run-time.

URL: http://www.decompile.com/cpp/faq/file_and_line_error_string.htm

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.