I am working with an opensource program running on an arduino mega. I am using vscode with the Platformio extension.
When I open one of the cpp files the problems list an undefined literal. When I contacted the open source group they told me they have a compiler macro defined and vscode (intellisense) just doesn’t recognize it so flags it. They told me to just ignore but I was curious if this can be identified/define in the platformio.ini file to inform intellisense of the macro.
The literal caught is _hk which is a macro to create a keyword hash at compile time. See below.
Is there a way to identify _hk as a valid command so it doesn’t report as a problem. Thanks.
Here is code inside a .h file.
constexpr uint16_t CompiletimeKeywordHasher(const char * sv, uint16_t running=0) {
return (*sv==0) ? running : CompiletimeKeywordHasher(sv+1,
(*sv >= '0' && *sv <= '9')
? (10*running+*sv-'0') // Numeric hash
: ((running << 5) + running) ^ *sv
); //
}
constexpr int16_t operator""_hk(const char * keyword, size_t len)
{
return (int16_t) CompiletimeKeywordHasher(keyword,len*0);
}