I read the following code from the PocketSphinx tutorial
config = cmd_ln_init(NULL, ps_args(), TRUE,
"-hmm", MODELDIR "/en-us/en-us",
"-lm", MODELDIR "/en-us/en-us.lm.bin",
"-dict", MODELDIR "/en-us/cmudict-en-us.dict",
NULL);
It's first time I see a variable--MODELDIR
--beside a string--"/en-us/en-us"
. How is this possible? I've never seen anything like this in C/C++ tutorial books!
If I want to search for more information about this, what keywords should I use for search?
MODELDIR
is a macro expanding to a string. C joins adjacent strings into single ones*, so if MODELDIR
would be #define
d to "/foo/bar"
, this would result in the following function call:
config = cmd_ln_init(NULL, ps_args(), TRUE,
"-hmm", "/foo/bar/en-us/en-us",
"-lm", "/foo/bar/en-us/en-us.lm.bin",
"-dict", "/foo/bar/en-us/cmudict-en-us.dict",
NULL);
*) So, writing
"Hello, " "World!"
is exactly the same as
"Hello, World!"