Date: Thu, 6 Dec 2007 21:25:01 +1100 (EST) From: Bruce Evans <brde@optusnet.com.au> To: Kip Macy <kmacy@FreeBSD.org> Cc: cvs-src@FreeBSD.org, src-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: Re: cvs commit: src/sys/sys param.h Message-ID: <20071206202639.N11122@delplex.bde.org> In-Reply-To: <200712060400.lB640xxi025146@repoman.freebsd.org> References: <200712060400.lB640xxi025146@repoman.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 6 Dec 2007, Kip Macy wrote: > kmacy 2007-12-06 04:00:59 UTC > > FreeBSD src repository > > Modified files: > sys/sys param.h > Log: > Respect the fact that the value a may be constant so cast to const uint8_t * > > Revision Changes Path > 1.318 +2 -2 src/sys/sys/param.h The correct fix is to back out 1.317. If not, at least spell `unsigned char' correctly and fix the other new style bug (a line longer than 80 characters from adding `const'). Using uint8_t is only a style bug since POSIX probably requires unsigned char to be the same as uint8_t. If unsigned char is larger than uint8_t, then revs.1.317-318 give undefined behaviour (aliasing bugs) and clearly broken behaviour (wrong divisor NBBY). These bugs are easy to avoid by using the correct spelling. The case where the pointer is to volatile unsigned char remains broken, and shouldn't be fixed by always casting to volatile const unsigned char *. It almost makes sense to use the original macros on volatiles (volatility would guarantee certain accesses), but casting to a smaller type is guaranteed to give different accesses, so always casting to volatile would silently break some cases (cases which didn't work before). Bruce
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20071206202639.N11122>