Re: So what's null then if it's not nothing?

From: N. Shamsundar <shamsundar_at__at_uh.edu>
Date: Tue, 22 Nov 2005 07:01:43 -0600
Message-ID: <dlv4rp$2shl$1_at_masala.cc.uh.edu>


Hugo Kornelis wrote:
> On Thu, 17 Nov 2005 10:27:55 -0600, N. Shamsundar wrote:
>
> (sniip)
>

>>Try this: every logical expression has three possible values, not two as 
>>in languages such as C, Pascal, Fortran, etc. They are, as you seem to 
>>have recognized, "TRUE", "FALSE" and "UNKNOWN" (named "NULL" in SQL).

>
>
> Hi N.,
>
> This is incorrect. "UNKNOWN" is not named "NULL" in SQL. See my long
> post to Mike.

Which one?

>

>>If 
>>you keep this in mind and refrain from using other notions such as the 
>>NULL in C (a pointer value that you may not dereference, etc.)

>
>
> Since SQL's Null is a marker or the absence of a value and C's NULL is a
> pointer to nothing, they are in fact more similar than you seem to
> suggest here.
>
> Best, Hugo

This short piece of C will illustrate that nulls in C are different from   SQL's null.

#include <stdio.h>
#include <string.h>

main(){
char *p,*q;
p=NULL; q="";
printf("%8p %8p\n",p,q); /* null pointer not same as null string */ printf("%s\n",p==NULL ? "NULL=NULL" : "NullA != NullB"); /* NULL can be compared to NULL */
}

Results:

        0 420000
NULL=NULL N. Shamsundar
University of Houston Received on Tue Nov 22 2005 - 14:01:43 CET

Original text of this message