pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Embedded SQL: Putting a guard around included stdio.h for convenience
5+ messages / 5 participants
[nested] [flat]

* Embedded SQL: Putting a guard around included stdio.h for convenience
@ 2003-10-01 22:57  Carsten Klein <carstenklein@yahoo.de>
  0 siblings, 2 replies; 5+ messages in thread

From: Carsten Klein @ 2003-10-01 22:57 UTC (permalink / raw)
  To: pgsql-interfaces


Hi all,

I have just tried to compile an application consisting of multiple 
modules, each of them encapsulation access to a single table of
the default database, using embedded sql.

Well, until now, I have had problems with stuff being declared twice 
(from stdio.h and successively included include files by stdio.h),
since postgres sources seemingly do not put a guard around the include 
statement.

what i mean is, please, do include the following:

#ifndef _STDIO_H
#include <stdio.h>
#endif /* _STDIO_H */

This seemingly is not being generated by the ecpg or included in the 
header files being included.

And while we are at it, although I personally think that Embedded SQL is 
quite obsolete by now (but we have to do this stuff in school, perhaps 
I'm wrong),
please check other parts of your source referencing (including) external 
include files, where there is no guard around the include statement. It 
makes things
tedious and nearly impossible to solve, when they are not there...


Thanks.

Carsten Klein





^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Embedded SQL: Putting a guard around included stdio.h for convenience
@ 2003-10-08 03:16  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Carsten Klein <carstenklein@yahoo.de>
  1 sibling, 1 reply; 5+ messages in thread

From: Tom Lane @ 2003-10-08 03:16 UTC (permalink / raw)
  To: carstenklein@yahoo.de; +Cc: pgsql-interfaces

Carsten Klein <carstenklein@yahoo.de> writes:
> what i mean is, please, do include the following:

> #ifndef _STDIO_H
> #include <stdio.h>
> #endif /* _STDIO_H */

What platform are you on, that is so brain-dead that stdio.h doesn't
do this for itself?

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Embedded SQL: Putting a guard around included stdio.h for convenience
@ 2003-10-08 07:18  Michael Meskes <meskes@postgresql.org>
  parent: Carsten Klein <carstenklein@yahoo.de>
  1 sibling, 0 replies; 5+ messages in thread

From: Michael Meskes @ 2003-10-08 07:18 UTC (permalink / raw)
  To: Carsten Klein <carstenklein@yahoo.de>; +Cc: pgsql-interfaces

On Thu, Oct 02, 2003 at 12:57:37AM +0200, Carsten Klein wrote:
> Well, until now, I have had problems with stuff being declared twice 
> (from stdio.h and successively included include files by stdio.h),
> since postgres sources seemingly do not put a guard around the include 
> statement.
> 
> what i mean is, please, do include the following:
> 
> #ifndef _STDIO_H
> #include <stdio.h>
> #endif /* _STDIO_H */

As Tom already pointed out it is stdio.h's job to guard against double
inclusion. The ifndef should be listed in stdio.h and certainly is on my
Debian system.

> And while we are at it, although I personally think that Embedded SQL is 
> quite obsolete by now (but we have to do this stuff in school, perhaps 
> I'm wrong),

Why is it obsolete? 

Michael
-- 
Michael Meskes
Email: Michael at Fam-Meskes dot De
ICQ: 179140304, AIM/Yahoo: michaelmeskes, Jabber: meskes@jabber.org
Go SF 49ers! Go Rhein Fire! Use Debian GNU/Linux! Use PostgreSQL!



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Embedded SQL: Putting a guard around included stdio.h for convenience
@ 2003-10-08 10:27  Peter Galbavy <peter.galbavy@knowtion.net>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 5+ messages in thread

From: Peter Galbavy @ 2003-10-08 10:27 UTC (permalink / raw)
  To: carstenklein@yahoo.de; Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-interfaces

Tom Lane wrote:
> What platform are you on, that is so brain-dead that stdio.h doesn't
> do this for itself?

Does POSIX say anything about multiple inclusion of this and others ?

(Genuine question, I do not have the "standards" to hand.)

Peter



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Embedded SQL: Putting a guard around included
@ 2003-10-08 18:23  Peter Eisentraut <peter_e@gmx.net>
  parent: Peter Galbavy <peter.galbavy@knowtion.net>
  0 siblings, 0 replies; 5+ messages in thread

From: Peter Eisentraut @ 2003-10-08 18:23 UTC (permalink / raw)
  To: Peter Galbavy <peter.galbavy@knowtion.net>; +Cc: carstenklein@yahoo.de, Tom Lane <tgl@sss.pgh.pa.us>; pgsql-interfaces

Peter Galbavy writes:

> Does POSIX say anything about multiple inclusion of this and others ?

"Except that the effect of each inclusion of <assert.h> depends on the
definition of NDEBUG, headers may be included in any order, and each may
be included more than once in a given scope, with no difference in effect
from that of being included only once."

-- 
Peter Eisentraut   peter_e@gmx.net




^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2003-10-08 18:23 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-10-01 22:57 Embedded SQL: Putting a guard around included stdio.h for convenience Carsten Klein <carstenklein@yahoo.de>
2003-10-08 03:16 ` Tom Lane <tgl@sss.pgh.pa.us>
2003-10-08 10:27   ` Peter Galbavy <peter.galbavy@knowtion.net>
2003-10-08 18:23     ` Re: Embedded SQL: Putting a guard around included Peter Eisentraut <peter_e@gmx.net>
2003-10-08 07:18 ` Michael Meskes <meskes@postgresql.org>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox