DragonFly BSD
DragonFly submit List (threaded) for 2005-02
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: VFS code questions


From: "Kevin M. Kilbride" <kmk@xxxxxxx>
Date: Fri, 25 Feb 2005 14:45:17 -0800

Joerg Sonnenberger wrote:

Some of this needs to be done to avoid overflows in intermediate results.



Perhaps in some instances; however, it cannot be the case that


return (int64_t) & (int32_t)

will ever overflow. Instead, the int32_t is implicitly promoted to int64_t and sign-extended before the bitwise operator is applied. This means that, if the smaller mask value can ever be viewed as "negative," it will unintentionally leave all high-order bits in the int64_t word unmasked. To then rely upon an explicit cast everywhere it is used in code to insure that this mangled value never bites anyone seems, to me, like playing with fire. If anyone starts extending or changing any of these facilities, they must be mindful of the fact that the explicit cast is part of the actual masking operation implicit in the macro. If they ever forget it, and they attempt to extend to a 64-bit interface with code that uses intermediate results, things may fail unexpectedly. It doesn't help that these logic relationships are hidden within layers of macros.

Don't use __inline__, that's a GNUism. Use __inline, which is a
preprocessor macro defined in sys/cdefs.h and handles unavailability
of inline support correctly.




Okay. I'll look over cdefs and see what's available. I wasn't aware that there was any interest in providing support for non-system compilers.


That often has historic reasons. I would be *very* careful about
changing it. The best person to consult is Kirk though.



Kirk? Kirk who? Are you talking about Kirk McKusick? Does he actually hang out around these parts? How would one go about asking him such a question?





[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]