I'm trying to incorporate term.h (part of the picocom source) into one of my programs but I ran across something that wont compile:
What is going on here? I've never seen anything like this before. I understand that the TERM_ are defined in the .h file and are an enum, but what's with the square brackets, and how can it be assigned text?
And why is the function ending with a semicolon? Everything about this function is just so weird, and apparently invalid since it's not compiling.
I get
error: expected primary-expression before \u2018[\u2019 token
For each of those lines.
Code:
static const char * const term_err_str[] = {
[TERM_EOK] = "No error",
[TERM_ENOINIT] = "Framework is uninitialized",
[TERM_EFULL] = "Framework is full",
[TERM_ENOTFOUND] = "Filedes not in the framework",
[TERM_EEXISTS] = "Filedes already in the framework",
[TERM_EATEXIT] = "Cannot install atexit handler",
[TERM_EISATTY] = "Filedes is not a tty",
[TERM_EFLUSH] = "Cannot flush the device",
[TERM_EGETATTR] = "Cannot get the device attributes",
[TERM_ESETATTR] = "Cannot set the device attributes",
[TERM_EBAUD] = "Invalid baud rate",
[TERM_ESETOSPEED] = "Cannot set the output speed",
[TERM_ESETISPEED] = "Cannot set the input speed",
[TERM_EPARITY] = "Invalid parity mode",
[TERM_EDATABITS] = "Invalid number of databits",
[TERM_EFLOW] = "Invalid flowcontrol mode",
[TERM_EDTRDOWN] = "Cannot lower DTR",
[TERM_EDTRUP] = "Cannot raise DTR",
[TERM_EDRAIN] = "Cannot drain the device",
[TERM_EBREAK] = "Cannot send break sequence"
};
What is going on here? I've never seen anything like this before. I understand that the TERM_ are defined in the .h file and are an enum, but what's with the square brackets, and how can it be assigned text?
And why is the function ending with a semicolon? Everything about this function is just so weird, and apparently invalid since it's not compiling.
I get
error: expected primary-expression before \u2018[\u2019 token
For each of those lines.