Re: example program bug?

From: Gavin Sherry <swm(at)linuxworld(dot)com(dot)au>
To: Tatsuo Ishii <t-ishii(at)sra(dot)co(dot)jp>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: example program bug?
Date: 2001-08-13 08:49:50
Message-ID: Pine.LNX.4.21.0108131833160.3410-100000@linuxworld.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, 13 Aug 2001, Tatsuo Ishii wrote:

> Included is a example program appears in our docs (libpq.sgml).
> As you can see, the very last part of the program:
>
> PQfinish(conn);
>
> return 0;
>
> never execute. Should we remove them?

Most compilers should be able to detect this and not generate
warnings. Compilers will default the return type of main() to int so
perhaps for the sake of form it should be left in there with a comment:

/* we never get here */

By the same line of thinking, PQfinish(conn) may as well stay.

There are other parts of the code which need fixing though. The call to
sleep() will generate a prototyping error on many systems, since it is
defined in unistd.h which is not included from the program in the 7.2
version of the docs (on the Web site). Similar problem with getenv(),
which is defined in stdlib.h.

Gavin

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Justin Clift 2001-08-13 13:25:42 Re: Re: [PATCHES] Select parser at runtime
Previous Message Hiroshi Inoue 2001-08-13 08:01:58 RE: PL/pgSQL bug?