Re: magic constant -1

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: magic constant -1
Date: 2009-11-06 05:18:17
Message-ID: 162867790911052118r855502erd950a8a914c0a5dc@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2009/11/5 Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>:
> Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> writes:
>> we use a value -1 as two values: a) unknown typmod, b) unknown
>> location. Can we substitute it by some better identifier?
>
>> Maybe: UnknownTmod, UnknownLoc ... UnspecTmd, UnspecLoc???
>
> Doesn't really seem worth the trouble, especially since the checks
> for "unspecified" are coded as negative/nonnegative rather than
> simple equality.

I worked on enhancing an area where typmod is used, and I had a small
problem - because it wasn't simply clean, where -1 is typmod or
location.

This should be an idea for enhancing and increasing code quality. -1
is probably last wide used magic constant in pg.

Pavel

>
>                        regards, tom lane
>

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2009-11-06 06:02:50 Re: Why do OLD and NEW have special internal names?
Previous Message abindra 2009-11-06 02:30:11 Freebsd & autoconf-2.63