I am using the __LINE__
, __FILEW__
and __FUNCTIONW__
macros to aid in the writing and implementation of a custom exception class. As is well known, they automatically provide the line number, source-file name and function name of the location in code from where they are called. Also, as I am working exclusively in Unicode I must use the ...W wide character versions of those that expand to a string result.
For example:
throw CEString(CEString::ERROR_INDEX_OUT_OF_BOUNDS,
__LINE__,
L"End index is smaller than start index",
L"Index Out of Bounds",
__FILEW__,
__FUNCTIONW__,
L"CString");
Where CEString
is a custom exception class whose Constructor takes two integer arguments and then five simple wide strings to locate and describe the error for which it is thrown.
I have the header files iostream
, new
and crtdefs.h
properly included. Going from the documentation the latter should not be strictly necessary, but as it is where the macros are actually defined I have included it anyway. However, the Intellisense error-checker in VS2013 highlights my use of the __FUNCTIONW__
macro as an error. It returns the following notification:
Error: identifier L__FUNCTION__ is undefined.
...which is strange!
Where this becomes even stranger is; the programme itself - despite this error warning - compiles happily and what is more even runs as expected. The supposedly debatable macro creates its wide-character function-name expansion without any complaint.
So this is obviously a problem with Intellisense, not the code or headers. Do any of you chaps have an idea what might be going wrong?
This is probably the closest previous question :
Why would __FUNCTION__ be undefined?
However, unlike Ben Voight I find the programme does actually link and run! The problem is explicitly with Intellisense.