Re: Invalid variant type conversion
From: Nicolai Hansen (nic_at_aub.dk)
Date: 01/22/04
- Next message: dieter: "High(Array) TQuickRep"
- Previous message: Jamie: "Re: ShBrowseForFolder & PIDL Memory Freeing"
- In reply to: Bjørge Sæther: "Re: Invalid variant type conversion"
- Next in thread: Bjørge Sæther: "Re: Invalid variant type conversion"
- Reply: Bjørge Sæther: "Re: Invalid variant type conversion"
- Reply: Bjørge Sæther: "Re: Invalid variant type conversion"
- Reply: Rob Kennedy: "Re: Invalid variant type conversion"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 22 Jan 2004 00:31:34 -0800
> In Delphi, there is no distinction between "" and a NULL string. Actually, a
> "" *is* a NULL string.
> While I can see why you need an "empty number" (for display purposes, e.g.),
> I can't see why you need e NULL string type. Well, in some cases it may be
> handy, but it makes all the normal cases much more cumbersome. Much like
> when you need to answer "Yes, I wanna save this d*ed document, why do you
> think I wrote it ?" in standard Win applications, to have the possibility of
> *not* saving. The 1% cases f*** up for the remaining 99%. Only true
> technicans could do this.
NULL / nil means "has no value" - which is basically different from
"an empty string" or "0".
When a database returns NULL it is because it doesn't have any data to
return to you. If it HAD data, but the data was "nothing" it would
return "" or 0 (or for a boolean; whatever bool value that is
default).
IMHO Borland made something not too smart when using NULL for an empty
string. '' is _NOT_ NULL. '' is '' - a string with nothing in it. An
empty string has a value, therefore it is not NULL.
Look upon databases, or programming languages where pointers are more
common to the language than in Pascal (C/Java for example).
In C, char *empty=""; and char *empty=NULL; is two different things.
Very different things. Unfortunately it is not so in Delphi.
Personally I never check a Delphi string for being nil - I check it
for being '' (or having length=0). In my eyes, nil has nothing to do
with an empty string; it is an undefined string.
- Next message: dieter: "High(Array) TQuickRep"
- Previous message: Jamie: "Re: ShBrowseForFolder & PIDL Memory Freeing"
- In reply to: Bjørge Sæther: "Re: Invalid variant type conversion"
- Next in thread: Bjørge Sæther: "Re: Invalid variant type conversion"
- Reply: Bjørge Sæther: "Re: Invalid variant type conversion"
- Reply: Bjørge Sæther: "Re: Invalid variant type conversion"
- Reply: Rob Kennedy: "Re: Invalid variant type conversion"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|