Warnings in library code [old code]
-
I use this VNC client .
In one of its sources, this code :void usekey(register unsigned long *from) { register unsigned long *to, *endp; to = KnL, endp = &KnL[32]; while( to < endp ) *to++ = *from++; return; }
error : ISO C++17 does not allow 'register' storage class specifier
warning : possible misuse of comma operator to = KnL, endp = &KnL[32];I knew it's possible to declare several variables in one line :
unsigned long *to, *endp;
but never saw assignment (is this possible because the declaration is done in one line also ? ) :
to = KnL, endp = &KnL[32];
should i correct this to make QtCreator happy ?
How to deal with the register ?
What about the old SIGNAL/SLOT syntax, should i replace with the new one ?
-
I would most likely compile this as a separate library with its own compilation rules and settings. I would also find out under which version of c++ it was written and use that for compilation. Unless I completely understood all the reasons for the code it might introduce bugs.
I am a little wary of that code and its lack of pointer verification, but I don't know what the rest of the code looks like.
-
I use this VNC client .
In one of its sources, this code :void usekey(register unsigned long *from) { register unsigned long *to, *endp; to = KnL, endp = &KnL[32]; while( to < endp ) *to++ = *from++; return; }
error : ISO C++17 does not allow 'register' storage class specifier
warning : possible misuse of comma operator to = KnL, endp = &KnL[32];I knew it's possible to declare several variables in one line :
unsigned long *to, *endp;
but never saw assignment (is this possible because the declaration is done in one line also ? ) :
to = KnL, endp = &KnL[32];
should i correct this to make QtCreator happy ?
How to deal with the register ?
What about the old SIGNAL/SLOT syntax, should i replace with the new one ?
@LeLev Looks like "register" keyword was removed in C++17: https://stackoverflow.com/questions/20618008/replacement-for-deprecated-register-keyword-c-11
This code will not compile with C++17 compiler without modifications.
"should i correct this to make QtCreator happy ?" - the "problem" is not QtCreator but the C++ compiler you're using.
Change tovoid usekey(register unsigned long *from) { unsigned long *to, *endp; to = KnL; endp = &KnL[32]; while( to < endp ) *to++ = *from++; return; }