On Fri, 22 Feb 2008, Plüm, Rüdiger, VF-Group wrote:

In general, that patch looks truly suspicious since it seems to me
it's typecasting wildly and not even using its newly invented
MAX_APR_SIZE_T in all places, because (apr_size_t)(-1) really is the
same thing, right?

No, MAX_APR_SIZE_T and (apr_size_t)(-1) might be different depending on the
platform. MAX_APR_SIZE_T is ~(apr_size_t)(0).

Won't both be 0xff...ff as long as apr_size_t is unsigned (which it should be)? If not, the code makes even less sense...

Both casting signed -1 to unsigned and flipping the bits of 0 are standard methods to get the max-value possible to store in a variable...

As I have overcome my confusion regarding apr_off_t / apr_size_t I hope to have a look into the problem and find a solution how to do all the casting stuff correctly.

My tip would be: less casts. If they're needed they're usually a sign of bad design or a thinko somewhere.

/Nikke
--
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
 Niklas Edmundsson, Admin @ {acc,hpc2n}.umu.se      |     [EMAIL PROTECTED]
---------------------------------------------------------------------------
 "Data, find the USS Pasteur." - Picard
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

Reply via email to