Predifined macro (__FUNCTION__)
-
I need to pass the macro __FUNCTION__ to a constructor (it's for error handling) but that macro will not work on any compiler. What I want to know is if there is a way of knowing if the macro is avaiable with pre-processor directives. Something like:
#ifdef SOMETHING
MyConstructor( int );
#else
MyConstructor( void );
#endifWhere SOMETHING is only defined if __FUNCTION__ is avaiable. Is this possible? If not, is there any other way? Thanks in advance hint_54
-
I need to pass the macro __FUNCTION__ to a constructor (it's for error handling) but that macro will not work on any compiler. What I want to know is if there is a way of knowing if the macro is avaiable with pre-processor directives. Something like:
#ifdef SOMETHING
MyConstructor( int );
#else
MyConstructor( void );
#endifWhere SOMETHING is only defined if __FUNCTION__ is avaiable. Is this possible? If not, is there any other way? Thanks in advance hint_54
hint_54 wrote:
...if __FUNCTION__ is avaiable.
Can't you just use:
#ifdef __FUNCTION__
...
#endif
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
-
hint_54 wrote:
...if __FUNCTION__ is avaiable.
Can't you just use:
#ifdef __FUNCTION__
...
#endif
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
-
I need to pass the macro __FUNCTION__ to a constructor (it's for error handling) but that macro will not work on any compiler. What I want to know is if there is a way of knowing if the macro is avaiable with pre-processor directives. Something like:
#ifdef SOMETHING
MyConstructor( int );
#else
MyConstructor( void );
#endifWhere SOMETHING is only defined if __FUNCTION__ is avaiable. Is this possible? If not, is there any other way? Thanks in advance hint_54
__FUNCTION__
was added in VC7, so you can test for the existence of__FUNCTION__
by checking the value of_MSC_VER
(the compiler version).--Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | NEW!! PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
-
__FUNCTION__
was added in VC7, so you can test for the existence of__FUNCTION__
by checking the value of_MSC_VER
(the compiler version).--Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | NEW!! PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
-
I really have little knowledge of non-MS compilers these days. RTFM ;)
--Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | NEW!! PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
-
I really have little knowledge of non-MS compilers these days. RTFM ;)
--Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | NEW!! PimpFish | CP SearchBar v3.0 | C++ Forum FAQ