So we using gcc on an embedded platform. ie. Very constrained flash & ram. We also using asserts. Storing __LINE__ and __FILE__ is taking too much flash. Question: I would like to create an assert macro .... #define Assert( expression) do {\ if(!(expression)) { \ assert_occurred_at_program_counter = THE_ADDRESS_OF_THIS_LINE(); \ } } while(0) So how do I write that magical function / macro THE_ADDRESS_OF_THIS_LINE(); That returns the address / PC at that line? Preferable in a CPU neutral fashion, otherwise for a Sparc CPU. John Carter Phone : (64)(3) 358 6639 Tait Electronics Fax : (64)(3) 359 4632 PO Box 1645 Christchurch Email : john.carter@xxxxxxxxxx New Zealand Carter's Clarification of Murphy's Law. "Things only ever go right so that they may go more spectacularly wrong later."
From this principle, all of life and physics may be deduced.