__func__ returns class name in debug but not in release

Viewed 82

I'm working with 12 year old legacy software written in Embarcadero C++ and I noticed: when you use __func__ or __FUNC__ in debug or release configuration for 32bit, it returns ClassName::FunctionName but when built in debug or release configuration for 64bit, it returns only FunctionName.

Is that expected behaviour and can I change that?

I'd like to have ClassName::FunctionName in 64bit release config, too.

I'm using Embarcadero® C++Builder 10.3 Version 26.0.36039.7899

My Google skills have failed me so far, thanks in advance.

1 Answers

You can use __PRETTY_FUNCTION__ to get the full function signature. This macro is not listed in Embarcadero documentation, so it might not work with the Classic compiler.

Output in C++ Builder 10.3.3 is like:

int ClassName::FunctionName(int, int)

If you need to remove the return value and arguments, just parse the string.

Related