Skip to Content.
Sympa Menu

freetds - element of style

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: James K. Lowden <jklowden AT speakeasy.org>
  • To: TDS Development Group <freetds AT franklin.oit.unc.edu>
  • Subject: element of style
  • Date: Sat, 24 Aug 2002 03:09:33 -0400


Contributors,

There are several places in e.g. tds/convert.c that use comparisons to
very strange decimal numbers. I'd like to see us use hex instead, when
we're looking for overflow conditions and such.

For instance in convert.c, line 2654, I think

if (num > 214748364u)

is a bug (Why 0xccccccc ?). Correct would be:

if (num > 2147483648u)

and clearer would be:

if (num > 0x80000000U) /* uppercase suffixes, please! */

Best, I'm sure, would be to include <limits.h> and apply some autoconf
magic to define things such that this would work:

if (num > INT_16_MAX)

because by relying on the system header files, we avoid bumping into
compiler corner cases, valid expressions that some compilers will fail to
comprehend.

--jkl




Archive powered by MHonArc 2.6.24.

Top of Page