Re: InvalidOid & C++

From: "Nigel J(dot) Andrews" <nandrews(at)investsystems(dot)co(dot)uk>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: "Jeroen T(dot) Vermeulen" <jtv(at)xs4all(dot)nl>, pgsql-patches(at)postgresql(dot)org
Subject: Re: InvalidOid & C++
Date: 2003-03-18 01:54:17
Message-ID: Pine.LNX.4.21.0303180150360.2462-100000@ponder.fairway2k.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

On Mon, 17 Mar 2003, Bruce Momjian wrote:

>
> How widespread is Oid(0) in C++? I have never seen anything like that.
> It looks like a function call!

It is, sort of, probably. Looks like a constructor of an instance of type
Oid. Certainly valid C++ I think, at least I'm sure something like
int(0) should work but then this is trawling through my memory somewhat.

As I don't know anything about this old style cast warning I can't say which is
supposed to be more acceptable.

>
> ---------------------------------------------------------------------------
>
> Jeroen T. Vermeulen wrote:
> > Compiling anything that uses InvalidOid under g++ yields a warning about
> > the expression using an "old-style cast." Therefore, would it be okay to
> > patch postgres_ext.h as follows:
> >
> >
> > *** src/include/postgres_ext.h 2003-02-22 16:24:28.000000000 +0100
> > --- ../postgres_ext.h 2003-03-06 21:44:11.000000000 +0100
> > ***************
> > *** 28,34 ****
> > --- 28,38 ----
> > */
> > typedef unsigned int Oid;
> >
> > + #ifdef __cplusplus
> > + #define InvalidOid (Oid(0))
> > + #else
> > #define InvalidOid ((Oid) 0)
> > + #endif
> >
> > #define OID_MAX UINT_MAX
> > /* you will need to include <limits.h> to use the above #define */
> >
> >
> > Jeroen
> >

--
Nigel J. Andrews

In response to

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2003-03-18 04:42:31 Re: minor SELECT doc patch
Previous Message Bruce Momjian 2003-03-18 01:52:51 Re: pg_get_triggerdef #2