Skip site navigation (1) Skip section navigation (2)

Re: correct NUL vs. NULL usage

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Neil Conway <neilc(at)samurai(dot)com>
Cc: PostgreSQL Patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: correct NUL vs. NULL usage
Date: 2003-09-24 13:54:43
Message-ID: 3440.1064411683@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-patches
Neil Conway <neilc(at)samurai(dot)com> writes:
> In C, "NULL" denotes a special pointer value indicating the pointer
> points to no value. "NUL" is the ASCII character that terminates a C
> string. These two terms are not synonymous, so this patch corrects the
> usage of NULL in comments in the postgres source.

However, lower case "null" is commonly used for both meanings.
I cite the C99 standard:

       ... A  byte with all bits set to 0,
       called  the  null  character,  shall  exist  in  the   basic
       execution character set; it is used to terminate a character
       string.

The standard thereafter consistently uses "the null character" to
refer to '\0'.  Kernighan & Ritchie first edition tends to use boldface
"\0" in running text, but the initial use of that symbol is *defined as*
"the <i>null character</>, whose value is zero" (their italics).

In my experience "NUL" is actually less common than other names for
the null character.

In short, I think most of this patch is just pedantry.  Could you
trim it down to just the places where there's actually risk of
confusion?  (I do agree that upper case NULL is not appropriate as
a name for the character.)

			regards, tom lane

In response to

Responses

pgsql-patches by date

Next:From: Bruce MomjianDate: 2003-09-24 18:08:11
Subject: Re: pgsql-server/src/backend catalog/index.c comma ...
Previous:From: Neil ConwayDate: 2003-09-24 06:21:08
Subject: correct NUL vs. NULL usage

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group