I came across this piece of code which used macro in a way I have never seen/couldn't understand. I tried googling but couldn't find anything like this. Source is from openVXI - open source implementation of voicexml.
extern "C" const VXIchar* VXIinterpreterGetImplementationName(void)
{
#ifndef COMPANY_DOMAIN
#define COMPANY_DOMAIN L"com.yourcompany"
#endif
static const VXIchar IMPLEMENTATION_NAME[] = COMPANY_DOMAIN L".VXI"; // how does this work?
if the macro COMPANY_COMAIN has not been defined with a specific value before this code in the current source file (and it's includes), it will be defined here with a default value
Sorry. I should have been more clear about the question.
Is L in (#define COMPANY_DOMAIN L"com.yourcompany) a part of macro name (i.e. COMPANY_DOMAIN) or it's definition? I am confused by the use of space in between 'COMPANY_DOMAIN' and 'L'.
If VXIchar is defined as
typedef wchar_t VXIchar;
what is the expected value of IMPLEMENTATION_NAME here?
I see this 'L' being used many places in the code .e.g
if (Compare(attributeValue, L"2.0")) version = 2.0f;
where attributeValue is of type const XMLCh* and 2nd param is supposed to be of type const VXIchar*. What am I missing or not knowing here? Is 'L' something special in C++?