freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
- 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
-
element of style,
James K . Lowden, 08/24/2002
- <Possible follow-up(s)>
- Re: element of style, Frediano Ziglio, 08/24/2002
- Re: element of style, Brian Bruns, 08/24/2002
- Re: element of style, Chris Eleveld, 08/24/2002
- Re: element of style, Frediano Ziglio, 08/24/2002
- Re: element of style, Frediano Ziglio, 08/24/2002
- Re: element of style, Brian Bruns, 08/24/2002
- Re: element of style, Brian Bruns, 08/24/2002
- Re: element of style, Frediano Ziglio, 08/24/2002
- Re: element of style, James K . Lowden, 08/24/2002
- Re: element of style, Chris Eleveld, 08/24/2002
Archive powered by MHonArc 2.6.24.