On 25 Aug 2022, at 02:22, Konstantin Belousov <[email protected]> wrote: > > On Thu, Aug 25, 2022 at 02:07:12AM +0100, Jessica Clarke wrote: >> On 25 Aug 2022, at 01:29, Konstantin Belousov <[email protected]> wrote: >>> + const unsigned char *u1 = __DECONST(const unsigned char *, s1); >>> + const unsigned char *u2 = __DECONST(const unsigned char *, s2); >> >> Why is __DECONST needed? Casting from const char * to const unsigned >> char * should never warn, surely? > > I requested the use of __DECONST there. Nobody knows what would be next > trend in the C language breaking among compiler writers. We guarantee > that __DECONST() is adopted to whatever warnings are added.
This is not good justification to do so. Sprinkling unnecessary __DECONST throughout the code base makes it harder to figure out what’s actually going on as you have to figure out if the __DECONST is actually doing something interesting or there out of paranoia. Jess
