Re: Nulls get converted to 0 problem - Mailing list pgsql-general

From Samuel Tardieu
Subject Re: Nulls get converted to 0 problem
Date
Msg-id 2003-06-06-17-31-40+trackit+sam@rfc1149.net
Whole thread Raw
In response to Re: Nulls get converted to 0 problem  (kdebisschop@alert.infoplease.com)
Responses Re: Nulls get converted to 0 problem  (kdebisschop@alert.infoplease.com)
List pgsql-general
>>>>> "kdebisschop" == kdebisschop  <kdebisschop@alert.infoplease.com> writes:

kdebisschop>   if (str == "")
kdebisschop>     printf ("This comparison above can segfault on some
kdebisschop>     systems\n");

No, it can't. You are comparing pointers (str and a pointer to a NULL
string). This is exactly the same as comparing integers. If any
compiler generates code which does a segmentation fault, it is far
from being (even remotely) a C compiler (and I'm not being pedantic
here).

If you meant strcmp(str, "") that's a completely different story.

  Sam
--
Samuel Tardieu -- sam@rfc1149.net -- http://www.rfc1149.net/sam

pgsql-general by date:

Previous
From: "David Olbersen"
Date:
Subject: (long) What's the problem?
Next
From: Stephan Szabo
Date:
Subject: Re: Possible bug in CREATE INDEX? Was: Re: Create index