Error-codes should be constants
Brought to you by:
lilyco
Although the error-codes (such as EINVSOCK) are, in fact, constant, because they are declared as integer values, the compiler (tested with g++) does not recognize them as such. For example, this code:
switch (UDT::close(u)) {
case 0:
return 0;
case CUDTException::EINVSOCK:
return ENOTSOCK;
default:
return EDOOFUS;
}
causes the following error:
g++46 -fpic -DPIC -I/opt/include -I/opt/include/tcl8.6 -c /home/mi/tcl-udt/tclUdtChan.cpp -o tclUdtChan.So
...
tclUdtChan.cpp:41:22: error: 'CUDTException::EINVSOCK' cannot appear in a constant-expression
Could the error-codes be turned into enum? The API and the ABI need not change... Would you like a patch?