Re: squid3-largeobj squid3/src HttpHdrRange.cc...

From: Henrik Nordstrom <henrik@dont-contact.us>
Date: Wed, 01 Aug 2007 01:59:50 +0200

On tis, 2007-07-31 at 21:09 +0000, chtsanti wrote:

> - Some convertions of variables to 64bit integers, for which I am not
> sure if really needed but they used to hold results of 64bit
> operations and I think it is not safe to downgrade 64bit integers ...

Please avoid casting unless needed. The compiler automatically promotes
to larger types when needed, and will tell you if you try to do the
reverse..

So stop casting things to (int64_t).

The exception is the upshifts if the value shifted may be large. But I
think these should be changed to store bytes to begin with avoiding the
problem. It's really more of a theoretical configuration limitation than
a real limitation. It's very unlikely anyone would want to configure
readahead_gap or quick_abort_min/max as large as 2 GB or more..

So make

Config.readAheadGap and Config.quickAbort.min/max b_size_t instead of
kb_size_t, and stop upshifting it to compare... Maybe even should be a
b_int64_t.

Probably we should even kill the kb_size_t type entirely, converting
them all to b_int64_t.

Focus on killing casts when not absolutely needed. Casts makes it nearly
impossible to find problems using automated methods..

Regards
Henrik

Received on Tue Jul 31 2007 - 18:00:02 MDT

This archive was generated by hypermail pre-2.1.9 : Wed Aug 01 2007 - 12:00:06 MDT