This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: Compatibility: g++-2.7.2 and g++-2.95.2
> thanks for the quick and helpful answer. However, I thing this was a
> very unfortunate decision: New semantics should have used a new name.
> I have some real trouble converting thinks like
> ``char foo[] = __FILE__ "/" __FUNCTION__;''
> It seems I must write a C++ class with a constructor now, because
> string concatenation in initialization will not work any longer.
Maybe, but that's a decision that dates a while back, so it is
unlikely to change, again. Interestingly enough, the C99 standard
follows your view: It uses __func__ in the new gcc way (as an array
variable), but with a name not used in existing compilers before.
Regardless, I guess you don't have to *write* such a class - just use
the existing string class:
#include <string>
#include <cstdio>
int main()
{
string s = __FILE__ "/" + string(__FUNCTION__);
puts(s.c_str());
}
> As a side-note: What is the correct preprocessor GNUC minor version
> to detect "egcs 1.0"? Maybe I want to use the older compiler...
It is 91. However, I believe this change is shared with 2.8, so you
may also check for 8 instead.
Regards,
Martin