Bottom line is: just hardcode the function name.
It isn't that hard, and it avoids confusion of sometimes getting
function names, and sometimes getting file names...which is why you'll
find everything (at least, that I have seen) hardcoded.
On Sep 9, 2009, at 12:45 PM, Eugene Loh wrote:
N.M. Maclaren wrote:
On Sep 9 2009, George Bosilca wrote:
On Sep 9, 2009, at 14:16 , Lenny Verkhovsky wrote:
does C99 complient compiler is something unusual
or is there a policy among OMPI developers/users that prevent me f
rom using __func__ instead of hardcoded strings in the code ?
__func__ is what you should use. We take care of having it defined
in _all_ cases. If the compiler doesn't support it we define it
manually (to __FUNCTION__ or to __FILE__ in the worst case), so
it is always available (even if it doesn't contain what one might
expect such in the case of __FILE__).
That's a good, practical solution. A slight rider is that you
shouldn't
be clever with it - such as using it in preprocessor statements. I
tried
some tests at one stage, and there were 'interesting' variations on
how
different compilers interpreted C99. Let alone the fact that it
might
map to something else, with different rules. If you need to play
such
games, use hard-coded names.
Things may have stabilised since then, but I wouldn't bet on it.
Would it make sense for someone who understands this thread to
update the devel FAQs? E.g., one of:
https://svn.open-mpi.org/trac/ompi/wiki/CodingStyle
https://svn.open-mpi.org/trac/ompi/wiki/ErrorMessages
_______________________________________________
devel mailing list
de...@open-mpi.org
http://www.open-mpi.org/mailman/listinfo.cgi/devel