From ripley at stats.ox.ac.uk  Wed Aug  8 09:25:10 2007
From: ripley at stats.ox.ac.uk (Prof Brian Ripley)
Date: Wed, 8 Aug 2007 08:25:10 +0100 (BST)
Subject: [Rd] Use of __FUNCTION__ and__PRETTY_FUNCTION__ is not portable
Message-ID: <Pine.LNX.4.64.0708080742240.15798@gannet.stats.ox.ac.uk>

These are C/C++ extensions found in several packages[1].  They are 
non-standard: the C99 standard has __func__ which should be used in C in 
place of either.  If you really want back compatibilty, try something like

#if __STDC_VERSION__ < 199901L
# if __GNUC__ >= 2
#  define __func__ __FUNCTION__
# else
#  define __func__ "<unknown>"
# endif
#endif

I don't know a portable equivalent in C++, but I do know that some non-GNU 
C++ compilers do not support these, so they should be conditionalized on
__GNUC__  (or tested for by configure).  For example, SunPro C++ supports 
__func__ as a (non-default) extension:

http://docs.sun.com/app/docs/doc/819-5267/6n7c46dpc?a=view

so probably configure should be used to test what is available.


[1] GOSim MCMCpack MasterBayes RGtk2 rcom smoothSurv

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



[Rd] Use of __FUNCTION__ and__PRETTY_FUNCTION__ is not portable
Prof Brian Ripley