Skip to Content.
Sympa Menu

freetds - RE: [freetds] coding style choices

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Lowden, James K" <LowdenJK AT bernstein.com>
  • To: 'FreeTDS Development Group' <freetds AT lists.ibiblio.org>
  • Subject: RE: [freetds] coding style choices
  • Date: Mon, 3 Nov 2003 13:30:20 -0500

> From: ZIGLIO Frediano [mailto:Frediano.Ziglio AT vodafone.com]
> Sent: November 3, 2003 6:17 AM
>
> > if (cd != (iconv_t)-1)
>
> Usually I use indent to fix style, I think indent is the
> problem... IMHO
> anyone should indent(1) all code before commit... perhaps a
> perl script
> to fix some strange formattings (like - 1 instead of -1) should be a
> good solution ... I know a big perl guru :)

I dunno, Freddy. indent(1) is a tool; I don't want to be a slave to it. It
really helps bring mangled code into good form, but it's not human.
Sometimes I wrap lines in ways that I think are clear but that indent would
redo.

> > static const iconv_t INVALID_DESCRIPTOR = (iconv_t)-1;
>
> IMHO is better a #define for portability problems...

I don't foresee any portability problem. It's one line of ANSI C. If
you're right, though, it's easy to change to a #define.

> > /*
> > * Multiline comments are formatted like this,
> > * and phrased as sentences.
> > */
>
> We already use a similar format... I don't understand the
> difference...

/* some of our comments
* look like this */
and
/* some of them are a series */
/* of single-line comments */

but
/*
* I like this way best, and
* I don't think indent(1) will help us here.
*/

> About ODBC formatting. We have attribute like henv, hdbc that are just
> pointers, not handles. I'd like to remove "h" from name. Another are
> attributes.

A handle is a way for a calling function to denote an object it doesn't
manage. It's up to the manager how to decode a handle. It may be a
pointer, an index into a pointer array, or something else.

In deciding whether or not to remove the 'h', I suggest you consider how
other ODBC hackers are used to thinking about these things. Then adopt the
Principle of Least Surprise.

> There are a structure with all attribute with
> names starting
> with "attr_". Perhaps is better to remove these attr structure and
> incorporate attributes in _hdbc/_henv/_hstmt.

Your call. Sounds right to me.

--jkl
-----------------------------------------
The information contained in this transmission may contain privileged and
confidential information and is intended only for the use of the person(s)
named above. If you are not the intended recipient, or an employee or agent
responsible for delivering this message to the intended recipient, any
review, dissemination, distribution or duplication of this communication is
strictly prohibited. If you are not the intended recipient, please contact
the sender immediately by reply e-mail and destroy all copies of the original
message. Please note that we do not accept account orders and/or instructions
by e-mail, and therefore will not be responsible for carrying out such orders
and/or instructions.






Archive powered by MHonArc 2.6.24.

Top of Page